in reply to Re^2: Calling a function form an external DLL with Inline::C on windows
in thread Calling a function form an external DLL with Inline::C on windows
I've tried it the way you did above:but it doesn't work, I get the same error message as in the case without the wrapper.int wrap_RegisterClient2(int cl_id, char* read_ip) { return RegisterClient2(cl_id, read_ip); }
The problem, I believe, is that unless all the parameters, and the return type, are types that the default typemap knows how to handle, Inline::C doesn't wrap and export it. And it appears that the default typemap doesn't know how to handle int *.
So, whilst this works fine:
#! perl -slw use strict; #use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => '_test', CLEAN_AFTER_BUILD => 0; int test( int i ) { return i; } END_C print test( 123 ); __END__ C:\test>test 123
This doesn't:
#! perl -slw use strict; #use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => '_test', CLEAN_AFTER_BUILD => 0; int test( int *i ) { return *i; } END_C print test( 123 ); __END__ C:\test>test Warning. No Inline C functions bound to Perl in C:\test\test.pl Check your C function definition(s) for Inline compatibility Use of inherited AUTOLOAD for non-method main::test() is deprecated at + C:\test\test.pl line 12. Can't locate auto/main/test.al in @INC (@INC contains: C:\test\_Inline +\lib C:/Perl64/site/lib C:/Perl64/lib .) at C:\test\test.pl line 12
There is the TYPEMAPS configuration option, but I haven't seen any (good) documentation on that. And finding the default typemap and looking at that doesn't yield many clues.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Calling a function form an external DLL with Inline::C on windows
by Anonymous Monk on Aug 06, 2010 at 12:58 UTC | |
by Anonymous Monk on Aug 06, 2010 at 14:20 UTC | |
by proceng (Scribe) on Aug 09, 2010 at 17:00 UTC | |
by kikuchiyo (Hermit) on Aug 12, 2010 at 08:57 UTC | |
by Anonymous Monk on Feb 13, 2015 at 22:11 UTC |