Optix application as a shared library

I have a project and want to include my Optix application as a shared library.
I am not sure if it’s really a problem related to optix but i will give a try.
With my own (gnu gcc) makefile, i compile the Optix application as an executable and everything works fine.

But if i am compiling the application as a shared library( with TARGET= optixapp.so and adding the -shared flag to the gcc compiler), I get a segmentation fault everytime when the context of the optix-program should be launched, contextcompile and everything else before works.

Can somebody help me out?
Thanks!

Nevermind, it was a classical c++ issue ;)