Sisyphus wrote:

> ----- Original Message ----- From: "Gregor Goldbach" <goldb...@dfn-cert.de>
> 
> Are
> there any magic configuration options for Inline::C I have to set
> (LDFLAGS for example?).
> 
> ===================================
> 
> Inline doesn't have an LDLFAGS config option. If there's an import lib that
> needs to be found, there's the config option:
> LIBS => '-L/path/to/library -lname',

I've used that option, too. However, I had no luck.

Since I thought that I had a linking problem I searched the web a bit
more and finally got information about DynaLoader.

My problem was that a symbol in the shared object built from the XS
module couldn't be accessed from the shared object built from the test
using Inline::C.

The solution is to tell DynaLoader to make the symbols available for
linking.

This is done by declaring the following method in the XS module:

           sub dl_load_flags { 0x01 }

(which in fact is stated at the very top of DynaLoader's man page)

So, this is the recipe for testing internal C functions of an XS module
with Inline::C:

--- snip ---

Make sure the module exposes its symbols by declaring

  sub dl_load_flags { 0x01 }

in the module. If you don't want to alter the XS module, declare this
method in the test program:

  BEGIN { *MyModule::dl_load_flags = sub { 0x01 } }
  use_ok(MyModule);

That's it! Your Perl test program may now call the internal C functions
of the XS module to test them.

--- snip ---

I'm not sure if this question is asked that frequently, but it might be
included in the FAQ anyway ;-)

Regards,
  Gregor

-- 
Dipl.-Inform. Gregor Goldbach (PKI Team), DFN-CERT Services GmbH, Phone:
+49 40 808077-621

DFN-CERT Services GmbH, https://www.dfn-cert.de,  Phone  +49 40 808077-555
Sitz / Register: Hamburg, AG Hamburg, HRB 88805,  Ust-IdNr.:  DE 232129737
Sachsenstraße 5, 20097 Hamburg/Germany, CEO: Dr. Klaus-Peter Kossakowski

DFN-PKI: https://www.pki.dfn.de/


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to