Jump to content

My DLL Call Returns a Pointer; How Do I Get to the Data?


Recommended Posts

Greetings, all,

I need to call a DLL in the Windows API. The DLL returns a pointer to an array; the array is a list of process identifiers (strings, I presume). What do I need to do with that pointer to get an array of strings?

Thanks!

Link to comment

You have to use MoveBlock. You also have to know the total size of this array. Just create Call Library Function node, put "LabVIEW" as library name and find MoveBlock function. Define arguments as usual. As pointer to destination use U8 Array of exactly same size (wire an initialized array to that input). Then you have to cut resulting array to pieces searching for zeros and convert these pieces to strings.

Link to comment

QUOTE (ACS @ Mar 11 2009, 03:38 PM)

Greetings, all,

I need to call a DLL in the Windows API. The DLL returns a pointer to an array; the array is a list of process identifiers (strings, I presume). What do I need to do with that pointer to get an array of strings?

Thanks!

When you say it returns an array pointer do you mean returning it as function return value? That would be a very ugly way for an API to return such a parameter!! And if those process identifiers are really strings that parameter is anyhow not for direct LabVIEW consumption, really!

However I would assume that they contain instead 32Bit integers for all practical OSes nowadays (possibly excluding 64 Bit versions). At least under Windows and Unix, OS Process Identifiers (or PIDs) are simply 32Bit numbers that can be passed to other APIs to identify a specific process.

But since it is an array you will first need to know how big it is anyhow, before you can do anything.

Can you give us the function protoytpe so we can see how it looks and what direction we will have to look for?

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.