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

Home » Public Forums » archive » Re: Returning pointers from C DLL
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: Returning pointers from C DLL [message #12599 is a reply to message #12594] Tue, 25 August 1998 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <35E2B4EB.E2C2577F@atm.ch.cam.ac.uk>, Simon Hall <shall@atm.ch.cam.ac.uk> writes:
> Hi,
>
> I need to write a dll that returns a pointer to an array of strings, ie
> I want to return a char** type.
>
> I can get it to return a single string using the /s_value keyword to
> call_external. How do I return an array of strings? I can't see any
> option to return a pointer.

I don't think that IDL would know what do with a char** type. IDL stores
and passes strings by descriptor. However, if what you want to do is to return
an array of strings, there is a workaround which I have used. Return instead a
2-D byte array, where each row of the byte array is one string. You can then
just use the IDL STRING() function to convert the byte array to a string array.
You cannot return this array as the function value, you will have to pass it as
a parameter to the function, where you dimension and create the array in IDL
before calling your function. If you can't live with these limitations then
you will have to use LINKIMAGE.

Here is an example from one of my programs:

array = bytarr(40, 16)
n = 0L
status = call_external('ezca', 'ezcaIDLGetEnumStrings', n, array)
if (status ne 0) then return, status
strings = string(array(*, 0:n-1))

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Printing PS Files on Windows Machines
Next Topic: Returning pointers from C DLL

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

Current Time: Sat Oct 11 06:03:27 PDT 2025

Total time taken to generate the page: 0.04690 seconds