Ruby C extension problems mingw, missing symbols?

  • Thread starter Conan Rubymanjaro
  • Start date
C

Conan Rubymanjaro

I've been working all day on this(I might just be useless today) but I
can't figure it out.

I'm trying to make a simple extension, but when I include it, I get an
error:

/alignment.so: 127: The specified procedure could not be found. -
Init_alignment.so


I'm running Ruby 1.8.6 (from the Ruby-one-click-installer) on windows.
I'm using the Mingw32 tools for compiling my code.

In my .cpp file:

void Init_alignment()
{

}


In my .rb file:

require 'alignment'
puts "WOO!"

My compile script:

g++ alignment.cpp -shared -o alignment.so
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -lmsvcrt-ruby18 -lmsvcrt
-Lc:/ruby/bin -O3 -export-all-symbols
 
N

Nobuyoshi Nakada

Hi,

At Thu, 6 Sep 2007 08:39:25 +0900,
Conan Rubymanjaro wrote in [ruby-talk:267817]:
./alignment.so: 127: The specified procedure could not be found. -
Init_alignment.so
g++ alignment.cpp -shared -o alignment.so

You use C++ compiler. Symbols in C++ object files are mangled
unless they are marked extern "C".

Try `nm --extern-only --defined-only alignment.so | grep Init_alignment'.
 
C

Conan Rubymanjaro

Ah, fantastic. That solved all my problems.

Nobuyoshi said:
Hi,

At Thu, 6 Sep 2007 08:39:25 +0900,
Conan Rubymanjaro wrote in [ruby-talk:267817]:
./alignment.so: 127: The specified procedure could not be found. -
Init_alignment.so
g++ alignment.cpp -shared -o alignment.so

You use C++ compiler. Symbols in C++ object files are mangled
unless they are marked extern "C".

Try `nm --extern-only --defined-only alignment.so | grep
Init_alignment'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top