Re: another call_external newbie [message #11347] |
Mon, 23 March 1998 00:00  |
Reinhold Schaaf
Messages: 10 Registered: March 1998
|
Junior Member |
|
|
<HTML>
<TT></TT> <TT></TT>
<P><TT>hdsfkj wrote:</TT>
<BLOCKQUOTE TYPE=CITE><TT>That was it all right..... Thank you.</TT><TT></TT>
<P><TT>David Fanning wrote:</TT><TT></TT>
<P><TT>> Donald Green (dfg@ai.mit.edu) writes:</TT>
<BR><TT>></TT>
<BR><TT>> > Hi, I'm a c programmer trying to implement some IDL for device
control.</TT>
<BR><TT>> > I need help debugging a short IDL program that uses call_external
to</TT>
<BR><TT>> > access routines in a</TT>
<BR><TT>> > dll written in C using VC++5.0 and IDL 5.0. Both code snippets
appear</TT>
<BR><TT>> > below. The problem seems to be</TT>
<BR><TT>> > accessing data passed by reference. The Message statement returns</TT>
<BR><TT>> > garbage but if I check</TT>
<BR><TT>> > the value of 'board' in IDL after the call_external is executed
it's</TT>
<BR><TT>> > value is indeed 1. Why can I change</TT>
<BR><TT>> > the value properly but not access it's value in the C routine?
Thanks</TT>
<BR><TT>> > for any help....</TT>
<BR><TT>></TT>
<BR><TT>> The most common reason Call_External fails is that the</TT>
<BR><TT>> C program expects 4 byte integers and it gets passed 2</TT>
<BR><TT>> byte integers. I suspect that is what is going on here.</TT>
<BR><TT>></TT>
<BR><TT>> Try setting the "board" variable to 34L and see if you</TT>
<BR><TT>> don't have better luck. Remember, default IDL integer</TT>
<BR><TT>> variables are SHORT integers in other programming</TT>
<BR><TT>> languages.</TT>
<BR><TT>></TT>
<BR><TT>> Cheers,</TT>
<BR><TT>></TT>
<BR><TT>> David</TT>
<BR><TT>> -----------------------------------------------------------</TT >
<BR><TT>> David Fanning, Ph.D.</TT>
<BR><TT>> Fanning Software Consulting</TT>
<BR><TT>> E-Mail: davidf@dfanning.com</TT>
<BR><TT>> Phone: 970-221-0438</TT>
<BR><TT>> Coyote's Guide to IDL Programming: <A HREF="http://www.dfanning.com/">http://www.dfanning.com/</A></TT></BLOCKQUOTE>
<TT></TT>
<P><TT>I am also developing programs with VC++50 and IDL and found the
following feature of VC++ helpfull:</TT><TT></TT>
<P><TT>Under VC++, select Projects..projects settings..Debug. Specify idlde.exe
(with full path) as "executable for debug session" (and also a working
directory if necessary). With these settings, running the debugger of VC++
starts a IDL session, allowing you to load, edit, compile, and run your
IDL program. Setting (IDL-) breakpoints outside and (VC++) breakpoints
inside your dll gives you a good tool for debugging your IDL-VC++ interface.</TT><TT></TT>
<P><TT>Servus,</TT><TT></TT>
<P><TT>Reinhold</TT>
<BR><TT></TT> <TT></TT>
<P><TT>--</TT>
<BR><TT> ************************************************************ * </TT>
<BR><TT> Reinhold Schaaf</TT>
<BR><TT> Ettighofferstr. 22</TT>
<BR><TT> 53123 Bonn</TT>
<BR><TT> Germany</TT><TT></TT>
<P><TT> Tel.: 0049-228-625713</TT>
<BR><TT> Email: schaaf@astro.uni-bonn.de</TT>
<BR><TT> ************************************************************ * </TT>
<BR> </HTML>
|
|
|