in reply to Re: shared-obj linking in xs-module
in thread shared-obj linking in xs-module

Thank you for your answer. But the problem is that "test" is an executable file, it is not a shared-obj. I cannot resolve myprints's symbols in libhelloworld.so. However I have tried to do this in helloworld.o:
helloworld.o : helloworld.c $(CC) -Wall -fPIC -I$(PERLCORE) -I. -c helloworld.c +-Wl,-rpath,$(EXTLIB_PATH) -o $@ -L$(EXTLIB_PATH) -lmyprint
without success. What do you suggest me?

Replies are listed 'Best First'.
Re^3: shared-obj linking in xs-module
by rafl (Friar) on Mar 16, 2006 at 14:02 UTC

    You're trying to link an object (.o) file against a library. You should do that with the shared-object file (.so).

    For example I use this commandline to link some of my XS code against a shared library.

    cc -shared -L/usr/local/lib xs/Connection.o xs/Loudmouth.o xs/Message +.o \ xs/MessageHandler.o xs/MessageNode.o xs/Proxy.o xs/SSL.o perlmouth.o \ build/perlmouth-gtypes.o -o blib/arch/auto/Net/Jabber/Loudmouth/Loudm +outh.so \ -lloudmouth-1 -lglib-2.0 -lgobject-2.0 -lgthread-2.0

    This works pretty well.

    Another possibility would be to link the libmyprint object file (.o) together with helloworld.o into helloworld.so.

    Cheers, Flo

      Thank you, for your suggestion. It functions very well, but the problem is that you have collected all obj-files in the sh-obj file. My posted code is just a short example, but in the real case I have many sh-obj files, and some of these could be proprietary one, in this case I have only sh-obj files.

      What I can do, in this generic case?

        Exactly what I did in the code example I posted. Linking the generated shared object against the libraries. In that example that libraries are also external (not proprietary, though) and I don't have built them myself. I built my code with the headers that are provided with those libraries and then link against their shared objects, which are more than one as well.

        Cheers, Flo