Archived

This topic is now archived and is closed to further replies.

Dredge-Master

extern "C++"

Recommended Posts

Dredge-Master    175
okay, here goes. When you link a C file to a C++ file, you declare the linked functions with extern "C". Now, in reverse it apparently will work with extern "C++" in a C file when linking to C++ file functions (according to Borland documentation anyway). I tried this today, and realised that the extern "" stuff isn''t usable in C, atleast not in the same format. There is no additional help in the documentations regarding this, and even though it isn''t a problem, I would still like to know if it does actually work. If anyone knows how to link in a C++ file function to a C file or if it is possible or no, could you post it? Cheers.
Beer - the love catalyst good ol'' homepage

Share this post


Link to post
Share on other sites
Kylotan    9854
C++ is a superset of C, which came first. Therefore you can make C++ work with C using the extern "C" keyword, but you''ll only get C to recognise extern "C++" if the compiler maker added that in as an extension. The only truly portable way is to make all the C++ functions as extern "C".

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites
Dredge-Master    175
cheers, that was what I was trying to confirm
"but you''ll only get C to recognise extern "C++" if the compiler maker added that in as an extension"

even though they said they did, I don''t think they actually did under the borland compiler. Oh well, no big loss.

Thanks again.



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites