comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL call_external and code distributed across several .so libraries
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL call_external and code distributed across several .so libraries [message #45698] Sun, 02 October 2005 16:28 Go to next message
Denis Barkats is currently offline  Denis Barkats
Messages: 4
Registered: October 2005
Junior Member
Hi, I am running IDL on a mac os X (10.3) and I was happy to have
gotten the "call_external" function to work under IDL using the simple
exemple described in Fanning's pages
(http://www.dfanning.com/tips/calling_c.html). But I'd like to use
call_external with pieces of codes distributed accross several
libraries. Here is my exemple: I have two C codes, generic.c and
utils.c( see below) and generic.c calls a function in utils.c.

generic.c:

int PowerOf2()
{
int output;
output=someFunction();
return output;
}

utils.c:

int someFunction()
{
return 32;
}

Here is how I compile them

gcc -c utils.c
gcc -c generic.c
ld generic.o -bundle -o generic.so
ld utils.o -bundle -o utils.so ( I get the following error here ld:
Undefined symbols: _someFunction )

Now how do I modify call_external to call PowerOf2, since it now
depends on code in both generic.so and
utils.so?

IDL>

print,call_external('/Users/denis/idl/bicep/generic.so','Pow erOf2',/i_value)


Thank you

Denis
Re: IDL call_external and code distributed across several .so libraries [message #45794 is a reply to message #45698] Mon, 03 October 2005 05:15 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Denis Barkats wrote:
> Hi, I am running IDL on a mac os X (10.3) and I was happy to have
> gotten the "call_external" function to work under IDL using the simple
> exemple described in Fanning's pages
> (http://www.dfanning.com/tips/calling_c.html). But I'd like to use
> call_external with pieces of codes distributed accross several
> libraries. Here is my exemple: I have two C codes, generic.c and
> utils.c( see below) and generic.c calls a function in utils.c.
>
> generic.c:
>
> int PowerOf2()
> {
> int output;
> output=someFunction();
> return output;
> }
>
> utils.c:
>
> int someFunction()
> {
> return 32;
> }
>
> Here is how I compile them
>
> gcc -c utils.c
This step "transforms" the C file to an "intermediate" format utils.o

> gcc -c generic.c
This has the same for generic.o

> ld generic.o -bundle -o generic.so
Now you are going to link, and so that you need the two *.o files.
The linker want to resolve symbols. That is the name "someFunction"
inside utils.c is a symbol that must be resolved. You need to provide
the two files so that linker now it.

This explanation is pretty poor but more or less this is the problem :)


> ld utils.o -bundle -o utils.so ( I get the following error here ld:
> Undefined symbols: _someFunction )
>
> Now how do I modify call_external to call PowerOf2, since it now
> depends on code in both generic.so and
> utils.so?
>
> IDL>
>
> print,call_external('/Users/denis/idl/bicep/generic.so','Pow erOf2',/i_value)
>
>
> Thank you
>
> Denis
>


--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
Grup de Recerca Aplicada en Hidrometeorologia (GRAHI)
Universitat Polit�cnica de Catalunya
Barcelona - SPAIN
-----------------------------------------------------
http://www.grahi.upc.edu
-----------------------------------------------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MODIS bowtie correction
Next Topic: Displaying Multidimensal Data

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 23:14:41 PDT 2025

Total time taken to generate the page: 0.55972 seconds