Re: error loading cxx local model in isis: undefined symbol

From: John Houck <houck_at_email.domain.hidden>
Date: Thu, 14 Nov 2013 15:45:06 -0500
On Wed, Nov 13, 2013 at 15:07 -0500, Thomas Dauser wrote:
> Dear isis-users,
> 
> did anyone experience problems including a cxx local model in isis?
> 
> Here is my problem: I compile it once with xspec:
> 
> initpackage fun_test lmodel.dat .
> 
> While I can load (and evaluate) it in xspec without errors:
> 
> XSPEC12>lmod fun_test .
> Model package fun_test successfully loaded.
> 
> however, for the same model library (without any recompiling), isis
> complains with
> 
> isis> load_xspec_local_models (".");
> Loading ././libfun_test.so
> Error loading symbol C_test for model fun
> Link error: ././libfun_test.so: undefined symbol: C_test
> 
> And isis is somehow right, as C_test is not defined ("nm -D
> libfun_test.so | grep C_test" does not give a result).

Since isis is (usually compiled as) a C program and not a C++
program, your model must export a "C" linkage symbol for isis
to link to.

What output does this produce?:
   nm libfun_test.so

The C++ symbols are usually "mangled" containing embedded
interface that describes the subroutine interface.
Probably your library contains only a C++ interface.

To provide a C-linkage symbol, your C++ interface must
provide an interface declared as extern "C" (and that also
follows the Xspec interface naming conventions).

Thanks,
-John

> 
> What am I missing here? Is there a difference, how I need to treat
> xspec and isis local models? I know that the "C_" has to be included
> in the lmodel.dat file to tell xspec/isis that this is C/C++ code
> and not fortran.
> 
> I have the latest isis version 1.6.2-27 and heasoft 6.14 installed.
> 
> Thanks for your help.
> 
> Cheers,
> Thomas
> 
> ----
> You received this message because you are
> subscribed to the isis-users list.
> To unsubscribe, send a message to
> isis-users-request_at_email.domain.hidden> with the first line of the message as:
> unsubscribe

----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Thu Nov 14 2013 - 15:45:39 EST

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:47 EDT