Re: Calling C++ from IDL [message #28028 is a reply to message #23688] |
Fri, 16 November 2001 06:35   |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
Hi Jauan,
If Nigel's advice doesnt solve your problem then it may be down to a bug in
the CC compiler.
Many moons ago I reported a bug to Sun where template methods were not being
instantiated when building as a library. The fault was not corrected in the
next few upgrades of solaris, but we are talking 5 years ago now! Note this
had nothing to do with IDL, and if this is the fault you will not be able to
build C++ executables linked to the template libraries either. If this is
the case then maybe they never corrected it, I could dust off the workaround
I came up with.
good luck
Martin
"Nigel Wade" <nmw@ion.le.ac.uk> wrote in message
news:9t2m3j$9oev$1@rook.le.ac.uk...
> Juan I. Cicuendez wrote:
>
>> Hi,
>>
>> I am writing you all to see if you could help me because I am
>> trying to call C++ code from IDL (I am working in Sun solaris). We
>> compile the C++ with CC with extern "C" and produced the .so and when
>> we
>> use call_external in IDL, it does not find the C++ template library
>> which were used in my C++ classes. Is any way to tell IDL where to
>> look for this library, or can this be done with make_dll (I don't know
>> the compilation options). Could you help me somehow, maybe there are
>> other ways, I am a bit desperate. Anyone know the compilation options
>> if you want to compile with gcc.
>>
>> The compilation options I used were:
>> CC -c -xarch=v9 otra.c
>> CC -G -xarch=v9 otra.o -o libotra.so
>>
>> from IDL we do:
>> S=call_external('libotra.so','mas')
>>
>>
>> Thanks a lot,
>>
>> Juan Cicuendez
>
> If the library is one of your own then you need to specifically link
> against it by adding it to the DSO creation command (CC -G -lyour_lib).
>
> Secondly, so that IDL will know where to look for it (if it's not on the
> standard search path) you either need to set the LD_LIBRARY_PATH env
> variable to the directory where the library is, or add a "runpath" to the
> link command with -R option.
>
> --
> -----------------------------------------------------------
> Nigel Wade, System Administrator, Space Plasma Physics Group,
> University of Leicester, Leicester, LE1 7RH, UK
> E-mail : nmw@ion.le.ac.uk
> Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
|
|
|