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

Sorry, but you used obj-files in your example. So, if you have just the header-file and the shared-object, how can you do?

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

    Those object files are part of my XS glue. They are build from the .c files generated form my .xs files. They corespond to helloworld.o in your example. They are not part of the library I'm binding to perl.

    Flo

      Sorry, I did not understand youe example. I thought that you linked all obj-file in one sh-obj, and it functions off course. Now I have seen that you use the tipical "-L<path> -l<lib>" C options.

      I tried to do the same in my Makefile, but is does not function, and returns the following error:
      libmyprint.so: cannot open shared object file: No such file or directo +ry at /usr/local/lib/perl5/5.8.7/i686-linux/DynaLoader.pm line 230.
      It looks like that I must tell to Perl where is my sh-object. I am tring with @dl_library_path in pm-file, but no success again...

      have you a suggestion for me?

        Either you use rpath to code the path to the shared object file into helloworld.so, or you put libmyprint.so into a standard library path (/usr/lib, /lib, directories in /etc/ld.so.conf, ...) and run ldconfig afterwards, or you set the LD_LIBRARY_PATH environment variable to the path where libmyprint.so lives. As an alternative you can also build libmyprint as a static library and link it into helloworld.so as a statically. That of course depend on the vendor of the library you want to bind as it'll only work if they provide a static library.

        Cheers, Flo