开发者

Ruby, C++, Swig some classes not being exported

I've been working on getting my library c++ Lavish working with ruby using swig. The issue is that only some of the classes I've included in the interface file can be used and I get no errors during compilation of the bundle or loading in ruby. My swig interface file can be viewed here.

An example of what works and what doesn't.

sean$ irb
>> require "lavish"
=> true
>> v1 = Lavish::Vector2.new(1,2)
=> #<Lavish::Vector2:0x1011a25a0>
>> puts v1.x
1.0
=> nil
>> display = Lavish::Display.new
dyld: lazy symbol binding failed: Symbol not found: __ZN6lavish7DisplayC1Ev
  Referenced from: /Users/seanc/Desktop/Lavish/samples/ruby/Tutorial 2 - Displaying A Triangle/lavish.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN6lavish7DisplayC1Ev
  Referen开发者_如何学JAVAced from: /Users/seanc/Desktop/Lavish/samples/ruby/Tutorial 2 - Displaying A Triangle/lavish.bundle
  Expected in: flat namespace

Trace/BPT trap

I can create the Display object in C++ and I have included the header in the swig interface file so I don't know where to look for what is wrong.

Any ideas?


Turns out it was a few issues, first off the extconf.rb file which generates the makefile for the swig wrapper wasn't trying to link in the framework (swig needs updated docs for os x). The second issue I had was that ruby seems to be a universal binary on snow leopard but wants to load x86_64 and not the i386 version (go figure). Now I have to recompile all my dependencies in universal frameworks x86_64. I'm sure there is a way to force i386 but I'd rather have 64bit support where available.


Are the library compiled really compiled ? (And not just the interface SWIG wrapper)

dynamic linker problem ??? The program dont know where is located the library for you program. Try to set LD_LIBRARY_PATH with your library directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜