# compTest.sh # generate and compile perxsi.c perl -MExtUtils::Embed -e xsinit -- -o perlxsi.c cc -Wall -fPIC -g -c perlxsi.c `perl -MExtUtils::Embed -e ccopts` # perlLib contains the function myPerlFunc which embeds and runs the interpreter cc -Wall -fPIC -g -c perlLib.c `perl -MExtUtils::Embed -e ccopts` # generate the dynamic libray cc -Wall -shared -Wl,-export-dynamic -o libDynamicPerl.so perlLib.o perlxsi.o `perl -MExtUtils::Embed -e ldopts` # linking of the library cc -Wall -L. -lDynamicPerl perlEmbedDynamic.c -o perlEmbedDynamicLinking # execute with linking, works fine ./perlEmbedDynamicLinking # dynamic loading of the library cc -rdynamic -o perlEmbedDynamicLoading perlEmbedDynamic.c -ldl # execute with dynamic loading, crashes ./perlEmbedDynamicLoading