c++ function can not call c routine or access c global variable. Why?

Corey Edwards tensai at zmonkey.org
Thu Mar 23 18:20:38 MST 2006


On Fri, 2006-03-24 at 09:07 +0800, Laurent R wrote:
> Yes, I compiled both parts of codes with the same compiler. But I did not 
> use extern "c" definition.

C and C++ link objects differently. By specifying 'extern "C"' you tell
the C++ compiler to use the C-style for the specified objects. C++ by
default will mangle the name to allow fancy things like overloading and
namespaces.

Corey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://plug.org/pipermail/plug/attachments/20060323/3339d4f4/attachment.bin 


More information about the PLUG mailing list