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

Home » Public Forums » archive » Building sharable object libraries for CALL_EXTERNAL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Building sharable object libraries for CALL_EXTERNAL [message #14591] Fri, 12 March 1999 00:00 Go to previous message
Octavi Fors is currently offline  Octavi Fors
Messages: 13
Registered: March 1999
Junior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<p>This is my first trial calling a C-routine from IDL with CALL_EXTERNAL,
and I have some problems with building <i>routine.so</i> file. It's just
a test, so the routine it's very simple:
<p><font size=-1>#include &lt;math.h></font>
<br><font size=-1>#include &lt;stdio.h></font>
<br><font size=-1>#include &lt;stdlib.h></font>
<br><font size=-1>#include &lt;fcntl.h></font>
<br><font size=-1>#include &lt;sys/types.h></font>
<br><font size=-1>#include &lt;sys/stat.h></font>
<br><font size=-1>#include &lt;string.h></font><font size=-1></font>
<p><font size=-1>float** routine(argc,argv)</font>
<br><font size=-1>int argc;</font>
<br><font size=-1>void *argv[];</font>
<br><font size=-1>{</font>
<br><font size=-1>int n, x, y;</font>
<br><font size=-1>float *input;</font>
<br><font size=-1>float **output;</font>
<br><font size=-1>int i,j;</font><font size=-1></font>
<p><font size=-1>&nbsp;input = (float *) argv[0];</font>
<br><font size=-1>&nbsp;n=*(int *) argv[1];</font>
<br><font size=-1>&nbsp;x=*(int *) argv[2];</font>
<br><font size=-1>&nbsp;y=*(int *) argv[3];</font><font size=-1></font>
<p><font size=-1>&nbsp;output=(float **)malloc(4*n);</font>
<br><font size=-1>&nbsp;for(i=0;i&lt;n;i++) output[i]=(float*)malloc(4*x*y);</font><font size=-1></font>
<p><font size=-1>for(j=0;j&lt;n;++j)</font>
<br><font size=-1>for(i=0;i&lt;x*y;++i)</font>
<br><font size=-1>output[j][i]=input[i];</font><font size=-1></font>
<p><font size=-1>return(output);</font>
<br><font size=-1>}</font>
<p>First, I try to create routine.o with:
<br><font size=-1>$ cc -pic -fsingle -c routine.c</font>
<br>no problem.
<p>Second, when I try to create routine.so with:
<br><font size=-1>$ ld -o routine.so -z text routine.o (changing '-assert
pure-text' to '-z text' because it's a SunOS Version 5.5.1)</font>
<br><font size=-1> Undefined&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
first referenced</font>
<br><font size=-1> &nbsp;symbol&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
in file</font>
<br><font size=-1> malloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
routine.o&nbsp; (symbol belongs to implicit dependency /usr/lib/libc.so.1)</font>
<br><font size=-1> .mul&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
routine.o&nbsp; (symbol belongs to implicit dependency /usr/lib/libc.so.1)</font>
<br><font size=-1> mcount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
routine.o</font>
<br><font size=-1>ld: fatal: Symbol referencing errors. No output written
to routine.so</font><font size=-1></font>
<p>It seems to need /usr/lib/libc.so.1. So I add it in the command line:
<br><font size=-1>$ ld -o routine.so -z text routine.o /usr/lib/libc.so.1</font>
<br><font size=-1> Undefined&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
first referenced</font>
<br><font size=-1> &nbsp;symbol&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
in file</font>
<br><font size=-1> mcount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
routine.o</font>
<br><font size=-1>ld: fatal: Symbol referencing errors. No output written
to routine.so</font><font size=-1></font>
<p>Malloc error is gone, but mcount (?) remains. Does anybody know what's
wrong with it?
<p>Thans in advance,
<p>Octavi.
<pre>--&nbsp;
============================================================ =====

Octavi Fors Aldrich

Astronomy Department</pre>

<pre>Physics Faculty</pre>

<pre>Avgda. Diagonal 647
08028 Barcelona
SPAIN

Telf: 34-934021122
Fax:&nbsp; 34-934021133
e-mail: octavi@fajnm1.am.ub.es

============================================================ ===== </pre>
&nbsp;</html>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Writing on X without X device (!)
Next Topic: Re: Colour maps ... (BYTE_SCALE)

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

Current Time: Wed Oct 08 19:11:37 PDT 2025

Total time taken to generate the page: 0.00479 seconds