in reply to Regexp and Inline::C
#!/usr/bin/perl use strict; use warnings; use Inline qw(C); c_func('AAA:BBB'); sub perl_sub { for (@_) { /^([^:]+):([^:]+)$/; print "$1 - $2\n"; } } __DATA__ __C__ void c_func(SV* text) { Inline_Stack_Vars; Inline_Stack_Push(newSVpvf("CCC:DDD")); Inline_Stack_Done; perl_call_pv("main::perl_sub", 0); Inline_Stack_Void; }
However, if your main() is a C function, I believe you need a different approach. I've never used it, but Inline::CPR ostensibly gives you a binary you can call from C which will handle the appropriate inheritance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp and Inline::C
by syphilis (Archbishop) on Apr 15, 2010 at 23:35 UTC |