How to extend an XS extension? (Inline::C?)

K

kj

One of the modules I use is a (huge) XS extension (say Foo.pm).
Unfortunately, this module is missing some functions that I need,
and that, for performance reasons, I need to code in C. These
functions are quite simple, so I thought I'd do this with Inline::C.
Unfortunately, I'm not getting very far.

I use the following in my code:

use Inline C => Config =>
INC => '-I/path/to/header/files',
LIBS => '-L/path/to/arch/auto/Foo -lFoo',
TYPEMAPS => '/path/to/Foo/typemap';

use Inline C => <<'EOCODE';

/* my C code */

EOCODE

Still the compiler complains that it cannot find certain functions
that are required by Foo's typemap file. These functions are
defined in the library Foo.so, which resides in /path/to/arch/auto/Foo,
but, despite the code above, the compiler compains of not being
able to find it. What am I doing wrong?

Thanks!

kj
 
S

Sisyphus

[snip]
I use the following in my code:

use Inline C => Config =>
INC => '-I/path/to/header/files',
LIBS => '-L/path/to/arch/auto/Foo -lFoo',

Not sure about this, but if you're trying to link to Foo.dll, then I think
you need to do it with MYEXTLIB instead of LIBS - something like:

MYEXTLIB => '/path/to/arch/auto/Foo/Foo.dll',

Let us know if that doesn't solve the problem.

I've not had need to use Inline C to access a perl dll .... and I'm
struggling to make sense of the need for it ... but that might just be a
result of my brain being somewhat inflexible :)

Cheers,
Rob
 
S

Sisyphus

Sisyphus said:
[snip]
I use the following in my code:

use Inline C => Config =>
INC => '-I/path/to/header/files',
LIBS => '-L/path/to/arch/auto/Foo -lFoo',

Not sure about this, but if you're trying to link to Foo.dll, then I think

Ooops - your shared object is an 'so' not a 'dll', so s/dll/so/g .
you need to do it with MYEXTLIB instead of LIBS - something like:

MYEXTLIB => '/path/to/arch/auto/Foo/Foo.dll',

Let us know if that doesn't solve the problem.

I've not had need to use Inline C to access a perl dll .... and I'm
struggling to make sense of the need for it ... but that might just be a
result of my brain being somewhat inflexible :)

Also check perldoc Inline::C-Cookbook and look for the section "Event
handling with Event.pm". This appears to be similar to what you're trying.

Cheers,
Rob
 

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,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top