Bug #1346
closedLinkage errors compiling C++ extension with VC8
Description
=begin
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 <winsock2.h>
#include <ws2tcpip.h>
}
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#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
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Assignee set to usa (Usaku NAKAMURA)
=begin
I think it is a VC8's matter. What do you think? < unak
=end
Updated by usa (Usaku NAKAMURA) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24179.
=end