Import a "C" function that returns a struct...
-
I have a .dll with "C" functions that I need to call. One of the functions returns a simple struct(2 doubles) If I try to use DllImport like this:
[ DllImport("somedll.dll] SomeStruct1 f1(SomeStruct1 *pS);
I get compiler error C3385 "a function that has a DllImport Custom Attribute cannot return an instance of a class" How can I import a function from a DLL that returns a struct??? Thanks a ton, Sam -
I have a .dll with "C" functions that I need to call. One of the functions returns a simple struct(2 doubles) If I try to use DllImport like this:
[ DllImport("somedll.dll] SomeStruct1 f1(SomeStruct1 *pS);
I get compiler error C3385 "a function that has a DllImport Custom Attribute cannot return an instance of a class" How can I import a function from a DLL that returns a struct??? Thanks a ton, SamI have ever thought, that exported functions cannot return a struct or class. Try to pass the return value by pointer:
void f1(SomeStruct1 *pS, SomeStruct1 *pReturn);
Robert-Antonio "Love without sex is like a fish without antlers"