Re: How to call fortran subroution? [message #24704] |
Mon, 16 April 2001 15:25  |
L. Paul Mix
Messages: 8 Registered: July 1996
|
Junior Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
web wrote:
<blockquote TYPE=CITE>Thank you very much. I use IDL under windows.
<p>I have generated vecadd.dll from visual fortran. Then I use
<p>result = call_external('f:\fortran\vecadd.dll','f:\fortran\vecadd ',
a,
<br>n_elements(a), x, n_elements(x), b)
<p>to call the dll. The error message is as following:
<p>% CALL_EXTERNAL: Error loading sharable executable.
<br>
Symbol: f:\fortran\vecadd, File = f:\fortran\vecadd.dll
<br>
ERROR_PROC_NOT_FOUND
<br>But I have dll file under f:\fortran. How to do then? May be I have
set
<br>wrong parameter.
<br>This is explanation of call_external:
<p>Result = CALL_EXTERNAL(Image, Entry [, P0, ..., PN-1])
<p>Entry:A string containing the name of the symbol in the library which
is the
<br>entry point of the routine to be called.
<p>I donot know how to set entry.
<p>Where can I find The IDL External Development Guide?
<p>Jiali
<p>"Liam Gumley" <Liam.Gumley@ssec.wisc.edu> wrote in message</blockquote>
<Deleted>
<br>For windows with Compaq (Digital) Fortran add the export line to your
wrapper subroutine:
<br> subroutine wvecadd (argc, argv)
<br>cDEC$ ATTRIBUTES DLLEXPORT :: wvecadd
<br> integer argc, argv(*)
<br> call vecadd(%val(argv(1)), %val(argv(2)),
%val(argv(3)), %val(argv(4)))
<br> return
<br> end
<p>When you call:
<br>junk = call_external('f:\fortran\vecadd.dll', '_WVECADD@8', p1, p2,
p3, p4)
<p>Note the @8 refers to the fact that two pointers are passed to wvecadd
for a total of 8 bytes. The syntax of Call_External makes this suffix
true for all Call_external calls on windows.
<p>Note on HP and Sun unix the entries are 'wvecadd' and 'wvecadd_', respectively.
You will need to branch if you are writing these routines form multiple
platforms.
<p>Good luck.
<br>
<br>
<pre>--
L. Paul Mix
Distinguished Member of the Technical Staff
Electromagnetics and Plasma Physics Analysis
Sandia National Laboratories
MS 1152, P.O. Box 5800
Albuquerque, NM 87185-1152
E-mail: lpmix@sandia.gov
Phone: (505) 845-7493
FAX: (505) 284-6078</pre>
</html>
|
|
|