I tried another way which simplify the fact of implement some code to C and then use this code in perl by:
My Inline code (compiles and works well):
#! perl -slw use strict; use Config; use Inline C => Config => BUILD_NOISY => 1, CCFLAGS => $Config{ccflags +}." -DDEBUG=1"; use Inline C => <<'END_C', NAME => 'Example', CLEAN_AFTER_BUILD =>0; #include <stdio.h> #include <stdlib.h> int add( int a, int b ) { int result; result = a + b; return result; } int main () { /* char *a = "print \"Hello from C!\\n\";"; */ code(); return 0; } END_C print "Everything went well ;)","\n";
My Example.pm file to load dll / so libraries (works well):
package Example; use 5.006; use strict; use base qw/Exporter DynaLoader/; our $VERSION = '0.00'; our @EXPORT_OK = qw/hello/; bootstrap Example $VERSION; 1;
In reply to Re^6: Extending perl with C dynamic library.
by Martin90
in thread Extending perl with C dynamic library.
by Martin90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |