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

Home » Public Forums » archive » Re: CALL_EXTERNAL and memory allocation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: CALL_EXTERNAL and memory allocation [message #29700 is a reply to message #29694] Sat, 09 March 2002 09:42 Go to previous message
Mark Rivers is currently offline  Mark Rivers
Messages: 49
Registered: February 2000
Member
lyubo <lzagorch@cs.wright.edu> wrote in message
news:a6d9nn$76k$1@mercury.wright.edu...
> I have to get back a string from C, and if I have a null string
> defined in IDL and passed to C it won't work, because there
> isn't any memory allocated to the string.
>
> In general, how can I allocate memory for a string in IDL?

I would recommend not passing strings to CALL_EXTERNAL, but rather pass a
byte array, it's easier and more portable, since the IDL string structure
definition changed between IDL 5.4 and 5.5.

In your wrapper routine.

b = bytarr(256) ; Must dimension for maximum string length
s = call_external('my_dll', 'my_funct', b)
; The external C routine places the string in the bytarr 'b', with NULL
termination.
str = string(b) ; Convert from bytarr to string


Mark Rivers
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Grayscale AND Binary Image
Next Topic: MODIS L1B - 250m

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

Current Time: Sat Oct 11 08:20:42 PDT 2025

Total time taken to generate the page: 1.35951 seconds