Keep It Simple, Stupid | |
PerlMonks |
Re^3: Better way to force Inline to use compiled binary instead of C source?by syphilis (Archbishop) |
on Jun 28, 2022 at 01:42 UTC ( [id://11145123]=note: print w/replies, xml ) | Need Help?? |
Has the same capability not been ported to Inline::C ? I've had a look ... and the capability in question has NOT been ported to Inline::C, but it seems do-able. Firstly, the patch to Inline/C.pm: And the Inline::C demo: bar.h prototypes the bar function: int bar (int); baz.h prototpyes the baz function: int baz (int); bar.c defines the bar() function: and baz.c defines the baz() function: It's probably important that each of those 4 files terminate with at least one empty line. But there's a snag I haven't quite got around yet: The first time I run my Inline::C script, it fails to compile because of undefined references to 'bar' and 'baz'. I then manually copy bar.h, baz.h, bar.c and baz.c to the Inline build directory that was created by that first run ... then I re-run the script, and all goes fine. And I end up with the expected output of: So ... I wonder if there's some way that I can make bar.h, baz.h, bar.c and baz.c visible to the build process without having to move them to the build directory ? Essentially, I think the problem is that, with the current OBJECT => '$(O_FILES)' arg, the .c snd .h files need to be in the same directory as the auto-generated Makefile.PL (ie the script's build directory). I'm hoping there's some way to get the message across that we want to use the .c and.h files from a different location. Otherwise, we face the task of getting Inline to move those files across to the build directory *before* the auto-generated Makefile.PL is run. Any ideas ? (I'll keep fiddling with it and see if I can come up with the right solution.) Having to manually copy files and re-run commands strikes me as being a little less than optimal ;-) Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|