Compiling shared libraries for use with call_external on a Mac [message #19702] |
Wed, 12 April 2000 00:00  |
arkos
Messages: 11 Registered: July 1998
|
Junior Member |
|
|
Hi,
A question for those out there who have used call_external in IDL with
(hopefully) C subroutines on the Macintosh.
I have an older version of Metrowerks Codewarrior (IDE 1.6.3, CW 9),
and have set the Project type to shared library, in the preferences
for the project. However, it doesn't seem to want to compile and
produce the shared library (it keeps looking for main(), while
the C file I'm compiling only contains a collection of subroutines).
I've (obviously) never created shared libraries before, so if anyone
has any pointers to help create one of these things, that would be
great. The documentation is scarce or non-existant in this matter.
Thanks in advance,
-- Greg
--
Gregory G. Arkos Institute for Space Research
arkos@NOSPAMphys.ucalgary.ca Department of Physics and Astronomy
Voice : +1 403 220 6958 The University of Calgary
FAX : +1 403 282 5016 Calgary, Alberta, CANADA T2N 1N4
|
|
|
Re: Compiling shared libraries for use with call_external on a Mac [message #19744 is a reply to message #19702] |
Fri, 14 April 2000 00:00  |
Rob Preece
Messages: 4 Registered: April 2000
|
Junior Member |
|
|
In article <arkos-1204001537010001@merlin.phys.ucalgary.ca>,
arkos@NOSPAMphys.ucalgary.ca (Gregory G. Arkos) wrote:
> An addition to what I asked below:
>
> I can add a "dummy" main() to the C file, and produce something
> which appears to be a shared library. However, when I try to
> use call_external from the IDL side, I get the error:
>
> % CALL_EXTERNAL: Error loading sharable executable.
> Symbol: testing_external, File =
> Documents:Arkos:SMS:PLOT:test_external_libs
> symbol was not found
> % Execution halted at: TEST_CALL_EXTERNAL 18
> Documents:Arkos:SMS:PLOT:test_call_external.pro
> % $MAIN$
>
> I don't know if I am doing something wrong on the C side in
> creating the shared library, or on the IDL side in the
> implementation, so any suggestions would be appreciated.
>
> Thanks again,
>
> -- Greg
>
OK, Greg, you have not exported your library's symbols (that is:
function names). There are several ways to do this.
The easiest is:
Go to the CW project's Settings Panel and look for the PPC PEF settings
panel under "Linker". Change the "Export" option from 'None' to 'All
Globals'. Re-link; things should be fine.
The better way is:
Do most of the previous, but this time select the 'Use ".exp" file'
option for "Export". Link once, find the .exp file that was created for
your project and open it for editing. Take out all but the function
names you wish IDL to call (there could be hundreds you don't care
about). Save the much reduced file and re-link.
- Rob Preece
UAH Dept. of Physics
Many thanks to the rest of you for enduring this somewhat of-topic,
Mac-centric ramble. I'll go and re-lurk now...
|
|
|