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

Home » Public Forums » archive » Re: IDL and DLL under windows
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: IDL and DLL under windows [message #24643] Tue, 10 April 2001 03:57
Dominik[1] is currently offline  Dominik[1]
Messages: 46
Registered: April 2001
Member
I think, 'undefined symbol' means, that IDL can't find the routine in the
DLL. Routines in a DLL must be exported. You can do this with a .def file or
with eg following entry in the header file:
#ifndef IDL_RETURN
#define IDL_RETURN __declspec(dllexport)
#endif

IDL_RETURN int function_name(int argc, void *argv[]);

The parameters are always passed by reference, so the DLL can change them.

I added example.h and example.c. Build a DLL with them and try this with
IDL:

temp = fltarr
temp=1.1
temp=2.1
temp=3.1
temp=4.1
temp=5.1
number = 5
out = 1.1 ; this is because out must also be a float!!

result = call_external('example.dll','sumarray',temp, number, out)

In out should now be the correct sum of the array.

Dominik

_____________________________
Dominik Paul
dpaul@ukl.uni-freiburg.de
Universit�tsklinikum Freiburg
Abt. PET/Nuklearmedizin



"StefanoM" <massetti@tiscalinet.it> schrieb im Newsbeitrag
news:9auh62$o6p$1@suite03.caspur.it...
> sorry for this long post.
>
> well, I would like to use my Fortran subroutine with IDL.
> To do this I have created a DLL whit MS Develop. Studio and then called
the
> subroutines from IDL with CALL_EXTERNAL. The problem is that ... it
doesn't
> work!!! This could be related to the way the parameters are passed to the
> soubroutines, by value or by reference. If I simply compile and link the
> subroutines 'as they are' into a DLL, then it is impossible to call them
> from IDL, otherwise, if I follow the example given with IDL (5.2):
>
>
> SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
> INTEGER*4 argc, argv(*) !Argc and Argv
> are integers
>
> j = LOC(argc)
> !Obtains the number of arguments (argc)
>
> !Because argc is passed by VALUE.
>
> c Call subroutine SUM_ARRAY1, converting the IDL parameters
> c to standard FORTRAN, passed by reference arguments:
>
> CALL SUM_ARRAY1(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)))
> RETURN
> END
>
> c This subroutine is called by SUM_ARRAY and has no
> c IDL specific code.
> c
> SUBROUTINE SUM_ARRAY1(array, n, sum)
> INTEGER*4 n
> REAL*4 array(n), sum
>
> sum=0.0
> DO i=1,n
> sum = sum + array(i)
> ENDDO
> RETURN
> END
>
>
> I get errors during the linking of the DLL, in particular: 'undefined
> symbol' related to the subroutine (SUM_ARRAY1) called from the 'interface'
> subroutine (i.e. SUM_ARAY that manages the passage of the parameters from
> IDL to DLL).
>
> Does anyone have experience about this ? Any suggestion ?
>
> Stefano
>
> stefano.massetti@katamail.com
>
>
>


begin 666 example.h
M(VEF;F1E9B!)1$Q?4D5455).#0H@(V1E9FEN92!)1$Q?4D5455).(%]?9&a mp;5C
M;'-P96,H9&QL97AP;W)T*0T*(V5N9&EF#0H-"DE$3%]215154DX@ <W5M87)R
=87DH:6YT(&%R9V,L('9O:60@*F%R9W9;72DI9" J87)G=EM=*0T*>PT*:6YT(&XA="!S+"IF
M+" J<W5M.PT*#0IF(#T@*&9L;V%T("HI(&%R9W9;,%T[#0IN(#T@*BAI;G0@
M*BD@87)G=ELQ73L-"G-U;2 ]("AF;&]A=" J*2!A<F=V6S)=.PT*#0IF;W(@
H*',@/3 N,#L@;BTM.RD@<RL]("IF*RL[#0HJ<W5M(#T@<SL-"@T*?0``
`
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL and DLL under windows
Next Topic: array dimensions

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

Current Time: Wed Oct 08 15:10:07 PDT 2025

Total time taken to generate the page: 0.00502 seconds