|
From: Keith M. <kei...@to...> - 2006-07-03 08:42:23
|
John Chung wrote, quoting cxf: >> I Follow the FAQ "How can an MSVC program call a MinGW DLL, >> and vice versa?" and generate the library testdll.lib. But >> when I use the testdll.lib in VC,it seems ok when linking >> with .c files, but when I change the file extenstion from >> ".c" to ".cpp", the VC can not link with it. Are there any >> difference between linking in C program and C++ program. > > Yes C++ has name mangling. And that name mangling is deliberately different between MinGW and MSVC; when you compile a ".cpp" file, the compiler assumes you want C++ binding for all public symbols, unless *you* tell it otherwise, (by declaring those symbols as `extern "C"'). You *cannot* share symbols with C++ binding between different compilers. This is a FAQ; I've lost count of the number of times it has been answered, in the last month alone! It's also discussed in detail on http://www.mingw.org/MinGWiki/index.php Please search the archives, and the MinGWiki, before posting such lazy questions. Much as I dislike telling anyone to RTFM: http://news.gmane.org/gmane.comp.gnu.mingw.user http://www.mingw.org/MinGWiki/index.php/FAQ Regards, Keith. |