Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interfacing C DLL with Fox.
Message
From
21/09/1998 13:09:51
 
 
To
21/09/1998 10:34:43
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00139024
Message ID:
00139106
Views:
39
>Just one more thing... Using the usual "__declspec(dllexport)" didn't make the function visible. I had to put it in the .DEF file. If you have any idea why this is, I'd appreciate to know. But it's not that important. :-)


Visual C++ is a C++ compiler, not a C compiler. In order to implement OOP, C++ compilers do strange things to function names. This is often referred to as “name mangling.” You must explicitly tell the compiler to give a function a standard (API) style function name. This is how I do it:
extern "C" __declspec(dllexport) type function1();
extern "C" __declspec(dllexport) type function2();
or
extern "C" {
    __declspec(dllexport) type function1();
    __declspec(dllexport) type function2();
}
The
extern "C"
declaration seems to only be necessary for the function prototype.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform