Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to extend an XS extension? (Inline::C?) (http://www.velocityreviews.com/forums/t893750-how-to-extend-an-xs-extension-inline-c.html)

kj 08-16-2005 01:17 AM

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





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

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

Sisyphus 08-16-2005 02:16 AM

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

"kj" <socyl@987jk.com.invalid> wrote in message

[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



Sisyphus 08-16-2005 02:26 AM

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

"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message
news:43014c9f$0$22557$afc38c87@news.optusnet.com.a u...
>
> "kj" <socyl@987jk.com.invalid> wrote in message
>
> [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



kj 08-16-2005 09:45 AM

Re: How to extend an XS extension? (Inline::C?)
 
In <43014c9f$0$22557$afc38c87@news.optusnet.com.au> "Sisyphus" <sisyphus1@nomail.afraid.org> writes:


>"kj" <socyl@987jk.com.invalid> wrote in message


>[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:


That did the trick. Thanks!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


All times are GMT. The time now is 10:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.