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 strarr()
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 strarr() [message #18229 is a reply to message #18212] Thu, 09 December 1999 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <384E7B7E.6672F751@sbrc.umanitoba.ca>, Richard Tyc <richt@sbrc.umanitoba.ca> writes:
> I need to call an external C function (unix/shared lib method) which
> will collect a string array of different size strings. I have been
> using call_external with success on returning other types (floats,
> strings etc) but this seems more challenging. The problem being I don't
> know how large each string will be in the string array so it needs to be
> dynamically allocated.
>
>
> I know the following can pass IN a string array and return a single
> string:
>
> replyStr = CALL_EXTERNAL('IDLquery_call.so','GetPatientList',strarr,$
> N_ELEMENTS(strarr), /S_VALUE)
>
> the key point in the C function being to make the returned string static
> to avoid memory leaks.
>
> Anyone care to point out how I might be able to retrieve a string array.

I have done this by having IDL pass a 2-D byte array, where the first dimension
is the maximum length string which can be returned. Null terminate each string
in your C code, and then convert the byte to array into a string with
s = string(byte_array)
after it is returned to IDL.

Mark Rivers
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Xinteranimate problem!!
Next Topic: Re: Breakdown after 10 min: IDL + WinNT

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

Current Time: Tue Dec 02 07:37:05 PST 2025

Total time taken to generate the page: 0.07914 seconds