extern "C" {
void say_hi();
}
####
#include <cstdio>
#include "say_hi.h"
void say_hi(){
printf("hello workd!\n");
}
####
g++ -I. -fPIC -c *.cpp
g++ -shared *.o -I. -olibsay_hi.so
####
>perl -e 'use Inline CPP=>q{ \
#include "say_hi.h" \
void test(){return say_hi(); } \
}, INC=>"-I.",LIBS=>"-lsay_hi"; test()'
####
perl: symbol lookup error: /home/xxx/test_so/_Inline/lib/auto/e_8555/e_8555.so: undefined symbol: say_hi
####
#include "say_hi.h"
main() {
say_hi();
}
####
g++ -L. -lsay_hi test.cpp -o test
####
>test
hello workd!