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

Home » Public Forums » archive » 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
CALL_EXTERNAL and strarr() [message #18244] Wed, 08 December 1999 00:00
Richard Tyc is currently offline  Richard Tyc
Messages: 69
Registered: June 1999
Member
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 was thinking about IDL_ImportArray or IDL_ImportNamedArray to create
an IDL Array.

so lets say in my C function I have

char *list[100] ; or should it be IDL_STRING *list100 ; ??????

and the function has gone off an filled this list with various sized
array strings.
(eg. list[0] = strdup("5char") list[1] = strdup("06char") where strdup
is using malloc implicitly)

Assuming I create an IDL array from this data, what mechanism do I have
of returning this data in the call_external function.

Thanks in Advance
Rich
[Message index]
 
Read Message
Previous Topic: Map_Image and interpolation
Next Topic: Q: Xmanager explanation?

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

Current Time: Fri Oct 10 15:31:07 PDT 2025

Total time taken to generate the page: 0.48133 seconds