C++ libokFrontPanel.so segfault

I am stuck with this for a week now. When compiling GXSM project with FrontPanel support, I get this weird recursion followed by segmentation fault:

#0 0x01374939 in ?? () from /lib/libc.so.6 #1 0x01376f33 in malloc () from /lib/libc.so.6 #2 0x0126b619 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6 #3 0x01f78197 in okFrontPanel_Construct () from ./libokFrontPanel.so #4 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e8d0) at okFrontPanelDLL.cpp:166 #5 0x01f781a3 in okFrontPanel_Construct () from ./libokFrontPanel.so #6 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e880) at okFrontPanelDLL.cpp:166 #7 0x01f781a3 in okFrontPanel_Construct () from ./libokFrontPanel.so #8 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e830) at okFrontPanelDLL.cpp:166 #9 0x01f781a3 in okFrontPanel_Construct () from ./libokFrontPanel.so #10 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e7e0) at okFrontPanelDLL.cpp:166 #11 0x01f781a3 in okFrontPanel_Construct () from ./libokFrontPanel.so #12 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e790) at okFrontPanelDLL.cpp:166 #13 0x01f781a3 in okFrontPanel_Construct () from ./libokFrontPanel.so #14 0x0808280b in okCFrontPanel::okCFrontPanel (this=0x8a9e740) at okFrontPanelDLL.cpp:166 -----------more same stuff-----------

and here’s GXSM Makefile.am

[CODE]# This is the Makefile.am for the gxsm core

bin_PROGRAMS = gxsm2

gxsm2_SOURCES =
gxsm_main.C
gxsm_conf.C gxsm_conf.h
okFrontPanelDLL.cpp okFrontPanelDLL.h
ScanControl.h ScanControlFPGA.h ScanControlFPGA.cpp
more_stuff more_stuff …

pixmapdir = $(datadir)/pixmaps

DEFS = @DEFS@
-O2
$(CFLAGS)
-Wall -Wstrict-aliasing=0 -ggdb

INCLUDES = -I…
-I$(includedir)
-I…/include (GXSM_CORE_CFLAGS) \ -DGNOME_ICONDIR=\""(pixmapdir)""

gxsm2_LDFLAGS = -export-dynamic $(GXSM_CORE_LIBS)

gxsm2_LDADD =
$(FFTW_LIBS)
-lnetcdf_c++ -lnetcdf -lglut

sysdir = $(datadir)/apps/System[/CODE]

tested with FrontPanel 3.1 and 4.0. My other project works just fine with different Makefile using the same lib and headers. I’m not very good with make files or system programming. Can I post anything else to help identifying the problem? Could you point me in right direction?

I can call construct function from GXSM project manually:

[CODE] typedef void (* DLL_EP)(void);

//pakviesti so paciam
void *lib_handle;
DLL_EP fn;
char *error;

fprintf(stderr, "Open ./libokFrontPanel.so");
lib_handle = dlopen("./libokFrontPanel.so", RTLD_NOW);
if (!lib_handle)
{
  fprintf(stderr, "%s\n", dlerror());
}

fn = (DLL_EP)dlsym(lib_handle, "okFrontPanel_Construct");
if ((error = dlerror()) != NULL)
{
  fprintf(stderr, "%s\n", error);
}

(*fn)();

dlclose(lib_handle);[/CODE]

this probably indicates problem rises from your C++ wrapper and not the lib itself. What compile parameters might I be overlooking?

Do our samples build and run properly for you?

— Begin quote from Opal Kelly Support;3122

Do our samples build and run properly for you?

— End quote

My other project works just fine using the same initialisation code. The problem lies either in compile/link parameters or includes from GXSM project.

Solution:
http://forums.opalkelly.com/showthread.php?980-usign-libokFrontPanel.so-from-another-shared-object