Project

General

Profile

Actions

Bug #1346

closed

Linkage errors compiling C++ extension with VC8

Bug #1346: Linkage errors compiling C++ extension with VC8

Added by mgma (Miguel Muñoz) over 16 years ago. Updated over 14 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32_80]
Backport:
[ruby-core:23096]

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 16 years ago Actions #1

  • 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 16 years ago Actions #2

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r24179.
=end

Actions

Also available in: PDF Atom