# compile/link shared lib which includes Perl interpreter: gcc -Wall -pedantic -fPIC -shared \ -o perl_test1.so perl_test1.c \ `/usr/local/perl/5.10.0/bin/perl -MExtUtils::Embed -e ccopts -e ldopts` # compile/link the test program that loads it using dlopen: gcc -Wall -pedantic -Wl,-rpath=. \ -o perl_test2 perl_test2.c \ -ldl # ...and run it: $ ./perl_test2 $VAR1 = 'this is a string';