Re: simple CALL_EXTERNAL [message #53757] |
Tue, 01 May 2007 18:35 |
Paul Sommer
Messages: 9 Registered: December 2006
|
Junior Member |
|
|
On May 1, 7:23 am, "skymaxw...@gmail.com" <skymaxw...@gmail.com>
wrote:
> as i can see there is two ways using CALL_EXTERNAL in IDL
>
> 1. without wrapped procedure. Only C function and CALL_EXTERNAL from
> IDL
>
> 2. with wrapped procedure. For it i need C-wrapper procedure and
> another C functions, and then CALL_EXTERNAL
> in both ways i need create DLL from C source code
>
> does somebody have simple examples for both ways ? (except C:\RSI\...
> \call_external\C)
>
> thanks
Personally I find Randy Frank's EXTPROC function really nice and easy
for accessing exported functions in pre-compiled dlls. Obviously
this assumes you've already compiled to a dll. See the following
IDL_Tools_63.zip archive in the Code Contrib. area on the ITT VIS
website (Thanks to Ronn Kling for originally hosting pre-IDL 6.3
versions from his website):
http://ittvis.com/codebank/search.asp?FID=431
Best regards,
Paul
|
|
|
Re: simple CALL_EXTERNAL [message #53772 is a reply to message #53757] |
Tue, 01 May 2007 06:23  |
skymaxwell@gmail.com
Messages: 127 Registered: January 2007
|
Senior Member |
|
|
as i can see there is two ways using CALL_EXTERNAL in IDL
1. without wrapped procedure. Only C function and CALL_EXTERNAL from
IDL
2. with wrapped procedure. For it i need C-wrapper procedure and
another C functions, and then CALL_EXTERNAL
in both ways i need create DLL from C source code
does somebody have simple examples for both ways ? (except C:\RSI\...
\call_external\C)
thanks
|
|
|
Re: simple CALL_EXTERNAL [message #53773 is a reply to message #53772] |
Tue, 01 May 2007 04:52  |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
have you tried this under linux? If it works there, my guess is you forgot
to export the symbol bmean. Haje
<skymaxwell@gmail.com> wrote in message
news:1177967940.895398.317470@u30g2000hsc.googlegroups.com.. .
> how call c - function from IDL for Windows
>
> for example example.cpp
>
> double bmean(float *array,int n)
> {
> double total=0.0;
> int i;
> for (i=0;i<n;i++) total+=(*array++);
> return (total/(double)n);
> }
>
> now i build example.dll
>
> now from idl
>
> idl> arr=randomu(s,1000000)*10000.0
> idl>mean=call_external("D:\WORK\idl\example\Debug
> \example.dll","bmean",arr, n_elements(arr),/d_value)
>
>
> i've got error - not found procedure
>
> CALL_EXTERNAL: Error loading sharable executable.
> Symbol: bmean, File = D:\WORK\idl\example\Debug
> \example.dll
>
> also i try with
> idl>mean=call_external("D:\WORK\idl\example\Debug\example.dll ","?
> bmean@@YANPAMH@Z",arr, n_elements(arr),/d_value)
>
> the same error
> i was try on both VC7.0 and VC6.0
>
> thanks
>
|
|
|