in reply to Re^2: Better way to force Inline to use compiled binary instead of C source?
in thread Better way to force Inline to use compiled binary instead of C source?
And the Inline::C demo:--- C.pm_orig 2021-12-20 22:11:48 +1100 +++ C.pm 2022-06-27 19:27:27 +1000 @@ -177,6 +177,10 @@ $o->{ILSM}{XS}{PREFIX} = $value; next; } + if($key eq 'OBJECT') { + $o->add_string($o->{ILSM}{MAKEFILE}, $key, $value); + next; + } if ($key eq 'FILTERS') { next if $value eq '1' or $value eq '0'; # ignore ENABLE, +DISABLE $value = [$value] unless ref($value) eq 'ARRAY';
bar.h prototypes the bar function: int bar (int);use warnings; use Inline C => Config => BUILD_NOISY => 1, OBJECT => '$(O_FILES)', ; use Inline C =><<'EOC'; #include "bar.h" #include "baz.h" void foo(int i) { printf("bar: %d\n", bar(i)); printf("baz: %d\n", baz(i)); } EOC foo(42);
and baz.c defines the baz() function:#include "bar.h" int bar (int in) { return in; }
It's probably important that each of those 4 files terminate with at least one empty line.#include "baz.h" int baz (int in) { return in + 1; }
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 ?bar: 42 baz: 43
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Better way to force Inline to use compiled binary instead of C source?
by syphilis (Archbishop) on Jun 28, 2022 at 12:34 UTC | |
by bliako (Abbot) on Jun 28, 2022 at 13:48 UTC | |
by syphilis (Archbishop) on Jun 29, 2022 at 04:02 UTC |