Dear forum users,
I came across an error related to the passing of a pointer from C++ to Fortran. This problem seems similar to several others on the forum that can be found by searching for "passing pointers" on the forum. However, my error seems to be related to working with Microsoft Visual Studio 2015 in combination with Intel Parallel Studio XE 2016 because the same code runs correctly on the VS 2008/ IVF 11.1. compiler. I haven't found other errors like that on the forum (yet ;-)
Here's the issue:
When I pass a pointer from C++ to Fortran I can check the pointer value (address) in the debugger, both on the C++ and on the Fortran side. On the C++ side the value is in HEX notation, on the Fortran side in decimal notation. I found that the pointer value is different on the Fortran side when it is received by the called Fortran subroutine (different from the value it had on the C++ side when the Fortran subroutine was called). Surely I have to convert HEX to DEC in order to check this, but the watch window can neatly do that for me.
So... this issue doesn't arise with the VS2008/IVF11.0 combination (address stays the same during the call).
Any help is appreciated, best regards,
You can change between decimal and hexadecimal display of values in the debugger by right clicking on the value in the watch window or similar, and [de]selecting "Hexadecimal display".
You need to show some code. Are you using C interoperability? Are you using in-source compiler directives? In particular, do you use !DEC$ ATTRIBUTES VALUE?
Thank you very much for your reply. I think I resolved it by dereferencing the particular pointer once more. I don't really understand why this is neccessary though, and particularly why this apparently is not neccessary in vs2008/IVF11.0.
I'll do some more testing tomorrow to see if I have overlooked anything. Should I have some findings worth mentioning, I'll let you know.
P.S. To answer you question as yet: I was (and still am) using ('RFMS' is the name of the subroutine involved): !DEC$ ATTRIBUTES DECORATE, ALIAS : 'RFMS' :: RFMS