From: "Miguel Muñoz" Date: 2009-04-02T00:05:08+09:00 Subject: [ruby-core:23096] [Bug #1346] Linkage errors compiling C++ extension with VC8 Bug #1346: Linkage errors compiling C++ extension with VC8 http://redmine.ruby-lang.org/issues/show/1346 Author: Miguel Mu��oz Status: Open, Priority: Normal Target version: 1.9.1 ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32_80] I've found two problems with extern "C" blocks while compiling some code generated by SWIG (the class example in the SWIG 1.3.39 distribution). I'm not sure if the problems came from Ruby or from SWIG, but I'd be grateful if someone can take a look at it. The first error was: ...\microsoft visual studio 8\vc\platformsdk\include\wspiapi.h(44) : error C2894: templates cannot be declared to have 'C' linkage I found a provisional workaround by modifying ruby-1.9.1-p0\include\ruby-1.9.1\ruby\win32.h, adding extern "C++" around some imports: #if !defined(WSAAPI) #ifdef __cplusplus extern "C++" { #include #include } #else #include #include #endif #endif The second error came from a Ruby file: ...\ruby-1.9.1-p0\include\ruby-1.9.1\ruby\missing.h(157) : error C2375: 'vsnprintf' : redefinition; different linkage (...\microsoft visual studio 8\vc\include\stdio.h(333) : see declaration of 'vsnprintf') For this one I just commented the vnsprintf function definition in missing.h: //RUBY_EXTERN int vsnprintf(char *, size_t n, char const *, va_list); Kind regards, Miguel ---------------------------------------- http://redmine.ruby-lang.org