[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DLL Interfacing; MOMENT comments



[posted and mailed]

You don't need any extra layer to call the functions in a DLL from
Windows IDL, just use call_external. The following is the IDL code to
call a function in a dll I wrote to play .wav files (seems IDL 5.3 does
that now..): 

dll='D:\Test Code\Play_Sound.dll'
wav_file = 'C:\test.wav'
result=call_external (dll, '?Play_Sound@@YAHHQAPAX@Z', wav_file, /ALL_VALUE) 

The /ALL_VALUE switch is needed since I'm passing a string. Depending on
the types of data you're sending and whether you're passing by value or
reference you'll want to check the documentation. If it makes no sense
send me some more details and I'll point you in the right direction. 

Note the strange name of the function in the DLL,
'?Play_Sound@@YAHHQAPAX@Z'. The function names get 'decorated' when they
are exported in a DLL (in my code it was originally just called
'Play_Sound'). This isn't the case if you use a .DEF file when compiling
the DLL, but here I didn't bother. You can find out the names of the 
functions in a DLL (whether decorated or not) by 'Quick-View'ing the DLL 
(right-click on the file and select Quick-View) - you may have to look 
through a few pages. 

Hope this helps,

Justin


wbiagiot@suffolk.lib.ny.us wrote in <824qn2$g8q$1@nnrp1.deja.com>:

>Hi Fellow IDLers,
>
>I've been working concurrently with IDL, MS C, and the National
>Instruments VISA library for awhile now.  It never occurred to me until
>now to ask if anyone has interfaced IDL with NI-VISA.  The task actually
>boils down to the topic that I've been avoiding learning due to my
>current workload - having IDL utilize an external predefined DLL.  I'm
>suspecting that there needs to be an intermediate layer between the two
>- something of the 'DLM' form.  If anyone can advise, please do.