LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL - Pointer to Boolean

Solved!
Go to solution

Hello guys,

 

I am trying to create a labview code that is able to acquire data from a IF2004 board (Micro-Epsilon). This is done calling the functions from the dll provided by the manufacturer.

However I've come to the point where I need to call a function, passing a pointer to a Boolean, and after it is done, read the value of the same Boolean. I looked some examples and tried to accomplish that by using the moveBlock function, but all I am getting is the 1097 error and don't know how to proceed.

The DLL function prototype is

int32_t OptoPCI_DAQ_HalfReady(uint16_t id, int32_t *HalfReady); 

 

The Labview code written is as it follows, with the DLL and the MoveBlock function

Pointer Boolean.JPG

What should I do so as to solve this problem? Thanks in advance for any help.

0 Kudos
Message 1 of 23
(4,434 Views)

You should not need MoveBlock at all, just pass the value by pointer rather than by value in the Call Library Function Node configuration screen.

0 Kudos
Message 2 of 23
(4,430 Views)

If the prototype is uint16 (by value) and int32 (by pointer) your dll call should only have these 2 parameters. Probably the boolean value is encoded as int32 since this must be passed as pointer.

See if the returned I32 value is what you want.

 

0 Kudos
Message 3 of 23
(4,429 Views)

Exactly as said the Boolean is encoded as the int32 variable (I forgot to explain that).

 

I tried to just read the variable at the terminal "Half Ready out" but got no success, the value read is just equal to the one wired to "Half Ready" as an input.

Then I assumed that this value was an address and therefore used the MoveBlock function, but as a result i got the error presented above.

 

0 Kudos
Message 4 of 23
(4,423 Views)

Did you configure the dll call to pass the I32 as "Pointer to Value"? And did you remove the boolean parameter?

I agree with Nathan that you should not need MoveBlock at all.

 

0 Kudos
Message 5 of 23
(4,419 Views)

Well, I imported the library, since I also have the header file, so Labview did all the configurations. Just checked your suggestion and is in that way that the function is configured, the int32 is a pointer.

0 Kudos
Message 6 of 23
(4,415 Views)

If what you wrote in your first post is really the prototype then I don't think the LV import wizard created the call you showed in your first post.

int32_t OptoPCI_DAQ_HalfReady(uint16_t id, int32_t *HalfReady); 

would have

  • a return parameter (I32, might be an error code or something)
  • a U16 id pass by value
  • a I32 HalfReady pass by pointer

Is your dll node configured like that now?

 

 

0 Kudos
Message 7 of 23
(4,404 Views)

This prototype is actually the prototype showed by the library node and everything seems to be configured as you said.

So, from what I am understanding so dar, the problem is related to the declaration of the variable?

0 Kudos
Message 8 of 23
(4,401 Views)

The error 1097 is thrown by the OptoPCI... function, not by MoveBlock, I guess.

Did you try to switch the Calling convention (stdcall / C)?

 

0 Kudos
Message 9 of 23
(4,397 Views)

No, I didn't. I'll try that soon and I'll post the results here.

Thank you for the help so far.

0 Kudos
Message 10 of 23
(4,395 Views)