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

Home » Public Forums » archive » Re: call_external: passing string from IDL to C
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: call_external: passing string from IDL to C [message #31956] Wed, 28 August 2002 16:53
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"selwyn yee" <selwyn_yee@yahoo.com> wrote in message
news:f15effdf.0208280041.422ee4a3@posting.google.com...
> Hi,
>
> I am trying to pass an IDL string to C using call_external. My setup
> is:
>
> IDL 5.5
> Visual C++ 6.0
> Windows 2000 Workstation
> P4 2Ghz, 512 mb
>
> I can't even get IDL's example to pass a string from IDL to C. I
> built the DLL from \RSI\IDL55\external\C\string_array.c. Then I debug
> the DLL from Visual Studio, and run string_array.pro. In debug, C
> receives and IDL_STRING structure with the proper length of the string
> (not counting NULL char). But you cannot see the string itself. You
> see
>
> "CXX0030: Error: expression cannot be evaluated"
>
> Has anyone gotten the example routines to work?

I tried it just now and it worked fine for me. Did the example work for you
by just running it without the debugger? If it didn't work, what happened?
Crash?

The only thing I can think of is to make sure that you are using the correct
export.h file. The definition of IDL_STRING changed with IDL 5.5. So, if
somehow you are building the DLL with the 5.4 export.h, that could cause
this sort of problem. But I think you would have had to modify the makefile
to cause this to happen. Or, the DLL was built in the 5.4 environment and
called by IDL 5.5.

In fact, I changed my makefile to point at the IDL 5.4 export.h and got
exactly the behavior you describe.

One way to check this is to get to the same place in the debugger where you
are looking at the IDL_STRING. Right click to go to hexadecimal format and
see how many hex digits there are in the slen field. If there are 4 hex
digits (short), then you built with a 5.4 export.h. If there are 8 hex
digits (int), then you used a 5.5 export.h.

It is a feature of the little-endian architecture that the VALUE of your
slen field still looked correct.

Karl
Re: call_external: passing string from IDL to C [message #31958 is a reply to message #31956] Wed, 28 August 2002 13:52 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
selwyn yee wrote:

> Hi,
>
> I am trying to pass an IDL string to C using call_external. My setup
> is:
>
> IDL 5.5
> Visual C++ 6.0
> Windows 2000 Workstation
> P4 2Ghz, 512 mb
>
Deae Selwyn

I belive you can only pass byte arrays. And if you have more
problems you should have a look at Ronn Klings book about C
and idl.

http://www.kilvarock.com/books/callingCfromIDL.htm

best regards

Reimar




> I can't even get IDL's example to pass a string from IDL to C. I
> built the DLL from \RSI\IDL55\external\C\string_array.c. Then I debug
> the DLL from Visual Studio, and run string_array.pro. In debug, C
> receives and IDL_STRING structure with the proper length of the string
> (not counting NULL char). But you cannot see the string itself. You
> see
>
> "CXX0030: Error: expression cannot be evaluated"
>
> Has anyone gotten the example routines to work?
>
> Thanks,
> Selwyn Yee

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Optimal interpolation
Next Topic: Re: Why does 0.8 = 0.80000001 ?

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

Current Time: Fri Oct 10 17:19:16 PDT 2025

Total time taken to generate the page: 0.96866 seconds