in reply to use Inline CPP to call function in so file not working

I think Anonymous Monk has provided enough for you to get things going.

If there's something in the POD that needs clarification, with the hindsight of having resolved your issue, please let me know. If it's something that would also be applicable to Inline::C, let syphilis know. We try to keep the documentation as approachable as possible, though given the complexity involved, it's easy to fall short in that regard. ;)


Dave

  • Comment on Re: use Inline CPP to call function in so file not working

Replies are listed 'Best First'.
Re^2: use Inline CPP to call function in so file not working
by codesoar (Novice) on Jan 10, 2014 at 06:59 UTC
      So far I've tried all sugestions to solve my problem ...

      I've just done some checking with Inline::C (not Inline::CPP), and it seems that you should also be able to link directly to the .so file using
      LIBS => '-L/path/to/so_file -lsay_hi',
      If that works with Inline::C (which it seems to), the same thing should probably be working with Inline::CPP.
      Of course, if libsay_hi.so is already in a location where the linker will find it, then the "-L/path/to/so_file" part should not be necessary.

      Could you double-check using "LIBS" with Inline::CPP ?

      I was initially of the view that EU::MM might do things that prevented you from linking directly to a shared object using the "LIBS" option - and that MYEXTLIBS would then be the *only* way of achieving this.
      But, like I say, this now seems to me to *not* be the case - with Inline::C and perl-5.18.0 at least.

      Cheers,
      Rob

      as I followed the instructions and examples there then end up with this question. I think other perl user will proberbly ask the same.

      While I believe adding examples is good, I doubt other perl users will probably ask the same, because 90% of the time you're connecting to an existing libfoobar.a you're not creating your own libfoobar.a (which is regular c/c++ programming)

      Answers from Anonymous Monk:

      You're confused by PerlMonks codewrapping feature, I never suggested -l+say_hi , I suggested you create a libsay_hi.a through whatever means, so that when you say -lsay_hi and g++/gcc/ld looks for libsay_hi.a it can find one