Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby C extension problems mingw, missing symbols?

Reply
Thread Tools

Ruby C extension problems mingw, missing symbols?

 
 
Conan Rubymanjaro
Guest
Posts: n/a
 
      09-05-2007
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

--------
It compiles fine, but it just doesn't seem to want to load my routines.
Anybody have any idea what the problem might be, and how to fix it?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Nobuyoshi Nakada
Guest
Posts: n/a
 
      09-06-2007
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'.

--
Nobu Nakada

 
Reply With Quote
 
 
 
 
Conan Rubymanjaro
Guest
Posts: n/a
 
      09-06-2007
Ah, fantastic. That solved all my problems.

Nobuyoshi Nakada wrote:
> 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'.


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a custom Ruby C extension method from other C extension IƱaki Baz Castillo Ruby 2 04-20-2011 12:24 PM
Ruby extension (C++) on OS X [ruby 1.8.2] and Google-Sketchup [ruby 1.8.5] Nicholas Ruby 3 01-28-2007 01:48 AM
New extension? saw extension .emf is it safe to open Jer Computer Support 5 10-08-2005 04:43 PM
C extension=> pow(2,1) gives DIFFERENT answers in different parts of C extension!?!?! Any ideas why? Christian Seberino Python 3 02-05-2004 04:36 AM
Unload extension modules when python22.dll unloads... [using C extension interpreter] Anand Python 3 11-08-2003 05:50 AM



Advertisments