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>
|
|
|
Re: another call_external newbie [message #11348 is a reply to message #11347] |
Sun, 22 March 1998 00:00  |
hdsfkj
Messages: 12 Registered: March 1998
|
Junior Member |
|
|
That was it all right..... Thank you.
David Fanning wrote:
> Donald Green (dfg@ai.mit.edu) writes:
>
>> Hi, I'm a c programmer trying to implement some IDL for device control.
>> I need help debugging a short IDL program that uses call_external to
>> access routines in a
>> dll written in C using VC++5.0 and IDL 5.0. Both code snippets appear
>> below. The problem seems to be
>> accessing data passed by reference. The Message statement returns
>> garbage but if I check
>> the value of 'board' in IDL after the call_external is executed it's
>> value is indeed 1. Why can I change
>> the value properly but not access it's value in the C routine? Thanks
>> for any help....
>
> The most common reason Call_External fails is that the
> C program expects 4 byte integers and it gets passed 2
> byte integers. I suspect that is what is going on here.
>
> Try setting the "board" variable to 34L and see if you
> don't have better luck. Remember, default IDL integer
> variables are SHORT integers in other programming
> languages.
>
> Cheers,
>
> David
> -----------------------------------------------------------
> David Fanning, Ph.D.
> Fanning Software Consulting
> E-Mail: davidf@dfanning.com
> Phone: 970-221-0438
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: another call_external newbie [message #11350 is a reply to message #11348] |
Sun, 22 March 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Donald Green (dfg@ai.mit.edu) writes:
> Hi, I'm a c programmer trying to implement some IDL for device control.
> I need help debugging a short IDL program that uses call_external to
> access routines in a
> dll written in C using VC++5.0 and IDL 5.0. Both code snippets appear
> below. The problem seems to be
> accessing data passed by reference. The Message statement returns
> garbage but if I check
> the value of 'board' in IDL after the call_external is executed it's
> value is indeed 1. Why can I change
> the value properly but not access it's value in the C routine? Thanks
> for any help....
The most common reason Call_External fails is that the
C program expects 4 byte integers and it gets passed 2
byte integers. I suspect that is what is going on here.
Try setting the "board" variable to 34L and see if you
don't have better luck. Remember, default IDL integer
variables are SHORT integers in other programming
languages.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|