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

Home » Public Forums » archive » Re: gcc and idl
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
Re: gcc and idl [message #7366] Fri, 08 November 1996 00:00
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Karl Young wrote:
>
> I am trying to call a C++ routine that I want to compile with
> gcc on a Sparc running SunOS 4.1.3 and call from IDL with
> CALL_EXTERNAL.
<snip>
>
> Has anyone done this sucessfully (i.e. used IDL with gcc) and if
> so any suggestions, e.g. what flags to use for the compile and
> link steps ? Thanks for any tips,
>
> -- KY


A typical compile line for me is:

gcc -fPIC -G -O3 -DSOLARIS -o bial_compr.so bial_compr.c

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: gcc and idl [message #7373 is a reply to message #7366] Thu, 07 November 1996 00:00 Go to previous message
jlaw is currently offline  jlaw
Messages: 11
Registered: November 1995
Junior Member
In article 446B9B3D@gojira.berkeley.edu, Karl Young <karl@gojira.berkeley.edu> writes:

> Has anyone done this sucessfully (i.e. used IDL with gcc) and if
> so any suggestions, e.g. what flags to use for the compile and
> link steps ? Thanks for any tips,


18 sparc10> cat > quick.c
#include <stdio.h>
int quick(void){
printf("Quick here") ;
return 4 ;
}
^C
19 sparc10> gcc -shared -o quick.so quick.c
20 sparc10> idl
IDL. Version 4.0 (sunos sparc).
Copyright 1989-1995, Research Systems, Inc.
All rights reserved. Unauthorized reproduction prohibited.

IDL> print,call_external("quick.so","quick")
Quick here 4
IDL> exit
21 sparc10>

you mention c++. Have you remembered extern "C"{}.


---
- ;-} --- :-{ --- ;-} --- :-{ --- ;-} -
Warning! Your Operating System is out of date!
It can be replaced by a more memory intensive Operating System.
Please contact your System Vendor for details.
--- ;-} --- :-{ --- ;-} --- :-{ --- ;-}
Re: gcc and idl [message #7377 is a reply to message #7373] Thu, 07 November 1996 00:00 Go to previous message
jbob is currently offline  jbob
Messages: 4
Registered: November 1996
Junior Member
In article <327FFE1A.446B9B3D@gojira.berkeley.edu> Karl Young <karl@gojira.berkeley.edu> writes:

> I am trying to call a C++ routine that I want to compile with
> gcc on a Sparc running SunOS 4.1.3 and call from IDL with
> CALL_EXTERNAL. The flags used for the compile and link calls given in
> the IDL manual examples for the SunOS cc compiler are very different
> from the ones I need to use with gcc so I'm apparently not building the
> right kind of shared object file (i.e. I'm getting messages like:
> ld.so: Undefined symbol: ___11spin_systemi)
>
> Has anyone done this sucessfully (i.e. used IDL with gcc) and if
> so any suggestions, e.g. what flags to use for the compile and
> link steps ? Thanks for any tips,

I had a similar problem with a slightly more difficult example -- using
a C++ routine with CALL_EXTERNAL from IDL where the C++ routine was a
wrapper for a FORTRAN routine. I found that I could only get it to work
by using the Sun linker.

The following Makefile section worked successfully on SunOS 4.1.2 with
its bundled "ld", gcc 2.6.3 and Sun SPARCompiler Fortran 2.0.1:

### NOTE: No "LD" define -- the default Sun linker is "/bin/ld".
CXX = g++
CXXFLAGS = -fpic
FFLAGS = -pic
LDFLAGS = -L/usr/lang/SC2.0.1
LDLIBS = -lF77 -lM77 -lpfc -lm

xxx.so: xxx.o ....
$(LD) -o xxx xxx.o ....


-----------------------------------------------------
J. Bob Brown jbob@snap.med.ge.com
Consulting for GE Medical Systems
For ID only -- standard disclaimers apply.

"Of course that's just my opinion. I could be wrong."
-Dennis Miller
-----------------------------------------------------
Re: gcc and idl [message #7384 is a reply to message #7373] Wed, 06 November 1996 00:00 Go to previous message
David Fenyes is currently offline  David Fenyes
Messages: 10
Registered: November 1996
Junior Member
Karl Young <karl@gojira.berkeley.edu> writes:

>
> I am trying to call a C++ routine that I want to compile with
> gcc on a Sparc running SunOS 4.1.3 and call from IDL with
> CALL_EXTERNAL. The flags used for the compile and link calls given in
> the IDL manual examples for the SunOS cc compiler are very different
> from the ones I need to use with gcc so I'm apparently not building the
> right kind of shared object file (i.e. I'm getting messages like:
> ld.so: Undefined symbol: ___11spin_systemi)
>
> Has anyone done this sucessfully (i.e. used IDL with gcc) and if
> so any suggestions, e.g. what flags to use for the compile and
> link steps ? Thanks for any tips,
>
> -- KY

I interface to the LAPACK library via a C wrapper.

Compiling with GCC, you should use:

CFLAGS=-fpic
LDFLAGS=-G

for Sun CC:
CFLAGS=-Kpic
LDFLAGS=-G

That's using GCC 2.7.2 and Sparcworks C 4.0

Good luck,

David.
--
David Fenyes University of Texas Medical School
dave@msrad71.med.uth.tmc.edu Dept. of Radiology
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Viewing unsigned int images (was: 16 bit / 8 bit depth colors on the mac)
Next Topic: Is there a replacement for STEPWISE in 4.0x?

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

Current Time: Wed Oct 08 17:26:07 PDT 2025

Total time taken to generate the page: 0.00480 seconds