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

From: Maurice Leutenegger <maurice.a.leutenegger_at_email.domain.hidden>
Date: Thu, 14 Nov 2013 16:03:10 -0500
Hi Thomas,

if you have declared your XSPEC local model function prototypes as "C++ 
style", i.e. using RealArray&s instead of Real*s, then you won't be able 
to use them even if the "extern C" linkage problem is fixed, since the 
function explicitly includes C++ objects in the interface to isis. I 
solved this problem by writing a wrapper function and then using the 
wrapper to create an isis alias function for each of my local models, 
e.g. myLocalModel (C++ inputs)-> myLocalModel_isis (C inputs). If this 
is useful to you, let me know and I will send you the source code for 
the wrapper.

Cheers,

Maurice


On 11/14/13 3:45 PM, John Houck wrote:
> 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.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 - 16:03:20 EST

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