PDA

Click to See Complete Forum and Search --> : extern "C" query


FantastichenEin
Mar 3rd, 2003, 09:48 AM
If I use extern "C" to define a function in a C++ DLL, do I still need to use a .def file to avoid name mangling?

Cheers

Jop
Mar 3rd, 2003, 12:37 PM
Yes, you have to use a .def file in this case :)

FantastichenEin
Mar 3rd, 2003, 03:28 PM
tried it out and didn't need a def file if extern "c" is used....

Jop
Mar 3rd, 2003, 03:33 PM
:rolleyes: I had too, but well if it works for you.. great ;)

Don't know, but when I looked at it using a Dependency Walker I still saw the weird names and couldn't use them, after inclusion of a .def it did work... weird :confused:

FantastichenEin
Mar 4th, 2003, 08:17 AM
on futher tests I discovered that you only need to put the function prototype in the extern "C" brackets. Did you try that?

Jop
Mar 4th, 2003, 09:16 AM
No I haven't... thanks for the info!!!