Extension which depends on another extension

J

Jeff Mitchell

I have two extensions, ext_x.so and ext_y.so. ext_y.so references a
few functions defined in ext_x.so.

On Linux this is okay; both build, link, and run fine. But on
Windows, gcc-mingw32 will not let me create ext_y.so, as it complains
about the undefined symbols which reside in ext_x.so.

I am aware of a few basics of Windows dll creation. I've been fussing
with dlltool, defining my functions with DllExport and trying to make
the lib and export files.

I'll probably eventually get it working, but there must be an easier
way. In the bigger picture, the Windows build is going to look
totally different than the unix build. If I could link with something
like --ignore-undefined that would be great, however I haven't found
such an option.

Is there something I'm missing, or is it really going to be this hard?
ext_x.so should remain independent. As a last resort, I suppose I
could combine the two extensions into one, but that would be pretty
messy. In fact, I have three other extensions which require ext_x.so.

TIA




__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
 
N

nobu.nokada

Hi,

At Thu, 17 Jun 2004 10:46:25 +0900,
Jeff Mitchell wrote in [ruby-talk:103890]:
I have two extensions, ext_x.so and ext_y.so. ext_y.so references a
few functions defined in ext_x.so.

Such usage is not guaranteed on all platforms.
Is there something I'm missing, or is it really going to be this hard?
ext_x.so should remain independent. As a last resort, I suppose I
could combine the two extensions into one, but that would be pretty
messy. In fact, I have three other extensions which require ext_x.so.

If I were you, I'd extract common portion to another shared
library, or define methods instead of direct references.
 
D

daz

Jeff said:
I have two extensions, ext_x.so and ext_y.so. ext_y.so references a
few functions defined in ext_x.so.

On Linux this is okay; both build, link, and run fine. But on
Windows, gcc-mingw32 will not let me create ext_y.so, as it complains
about the undefined symbols which reside in ext_x.so.

In the bigger picture, the Windows build is going to look
totally different than the unix build. If I could link with something
like --ignore-undefined that would be great, however I haven't found
such an option.

Is there something I'm missing, or is it really going to be this hard?
ext_x.so should remain independent. As a last resort, I suppose I
could combine the two extensions into one, but that would be pretty
messy. In fact, I have three other extensions which require ext_x.so.

You have to link ext_y.so with the dynamic lib file for ext_x.so which
will be a list of offsets to where the functions reside in ext_x.so .

If you're not actually using those functions in ext_x, maybe you could:

#ifdef _win32_ // or whatever it is for gcc :)
#endif

.... around them. Or include dummy functions inside "#ifdef"s ??
(which is what Nobu just suggested, IIUC)

I use Borland C and talk rubbish, so don't take too much notice :)


daz
 
J

Jeff Mitchell

--- [email protected] said:
Hi,

At Thu, 17 Jun 2004 10:46:25 +0900,
Jeff Mitchell wrote in [ruby-talk:103890]:
I have two extensions, ext_x.so and ext_y.so. ext_y.so references a
few functions defined in ext_x.so.

Such usage is not guaranteed on all platforms.

Yes I didn't realize that until now. It makes sense, since there is no
ext/socket/socket.h for example.
If I were you, I'd extract common portion to another shared
library, or define methods instead of direct references.

Aha, they are defined as ruby methods already but for some reason I didn't
think to call them with rb_funcall. Thanks.






__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top