Without any code I wouldn't want to try to guess from all the many ways that XS code could fail to "do what you want." I can say, however, that if all you need is Perlish access to a C library, the work is 90% done when you use Inline::C correctly.
In specific, look at the ...
Config =>
ENABLE => 'AUTOWRAP' =>
LIBS => '-lwhatever';
...configuration options.
Here's a snippet from the Inline::C-Cookbook:
package MyTerm;
use Inline C => Config =>
ENABLE => AUTOWRAP =>
LIBS => "-lreadline -lncurses -lterminfo -ltermcap ";
use Inline C => q{ char * readline(char *); };
package main;
my $x = MyTerm::readline("xyz: ");
It's never quite as easy as it looks. You will need to be aware of how the library allocates memory on the heap so that you can free it appropriately (to avoid leaks). And that's just the start of the "gotchas". But Inline::C does handle a lot of the boilerplate for you.
|