I have an interface to a stdcall libary, and the documentation says the function return a C pointer. The interface says:
PUBLIC :: fred INTERFACE FUNCTION fred() !DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"fred" :: fred IMPORT TYPE(C_PTR) :: fred END FUNCTION fred END INTERFACE
This is Window X32 and link the linker fails looking for _fred@4 whearas the correct libaray symbol is _fred@0.
Integer(4) :: fredworks fine so may questions are:
1) What is the content of type C_PTR, I would have thought is was (in x32) just and Integer(4)?
2) Is the !DEC$ line incorrect in this case, if so what should it have said. I guess removing the decorate and manually decorating would have worked perhaps, but that would just seem wrong.
3) Is is !DEC$ line actually not functioning correctly in this case?
4) Is the use of C_PTR incorrect and should I be using a KIND parameter that is INT_PTR_KIND()
5) Is C_PTR use only relevant id using BIND(C) which won't work in this case anyway.
6) Could be have a none standard !DEC$ ATTRIBUTE bind_C_decorate please so we could have one at the top of the module file and not then have to have zillions of non-standard !dec$ attributes littered through the source file?