LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing boolean values to DLL

Hi,
 
Currently I am using VB .NET to pass a boolean to a DLL... i've tried this with Strings and did not have a problem... but when i want to pass booleans over, i got a 'System.EntryPointNotFoundException' error Smiley Sad ...
 
i suspect the problem lies with LabVIEW not accepting boolean as 'True' or 'False', or '1' or '0'... or am i wrong?? any help is greatly appreciated Smiley Very Happy ...
 
attached is a simple code... hope i did it correctly... Smiley Indifferent
Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 1 of 13
(5,492 Views)

Hi JQ

In your vi there is just a casestructure with a message box express vi in it. I think you have to revise it, as you said you have problems with a dll-call.

 

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 13
(5,478 Views)

thanks becktho for the reply... as you noticed, the vi i attached was a very simple break down of what i intend to do... my main objective is to use VB .NET to pass boolean parameters over to the DLL, which is created using LabVIEW...

the current problem i'm facing is i am able to pass Strings from VB .NET to the DLL but not booleans... whenever i pass booleans over, i get some error that they cannot find an entry point...

sorry for being vague in my explaination Smiley Sad ...

Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 3 of 13
(5,473 Views)

I can't see your code, but generally, BOOL should be defined as a numeric and not as a string.

I don't think it matters which type of numeric it is, since I believe only the LSB is used, but you should read the documentation on this to be sure. There is quite a long document on this which is shipped with LV (or maybe it's part of the manual?).

You can learn more by searchinig the site.


___________________
Try to take over the world!
Message 4 of 13
(5,475 Views)
thanks tst... so from VB .NET i convert the boolean from True/False to 0,1... and when the value is passed over to the DLL (LabVIEW) i must convert it from 0,1 to True/False again... is it true??
 
on my actual code, i need 4 checkboxes... so do i need to do it 4 times??
Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 5 of 13
(5,465 Views)
I'm sorry, I thought you were building the DLL in VB.net.
I have no experience with building DLLs in LV, so I can only suggest that you read the documentation to see what the exported type of a LabVIEW boolean is.

___________________
Try to take over the world!
0 Kudos
Message 6 of 13
(5,458 Views)
Hi JQ,
I downloaded your zip-file and found a c-Header- file where the your function is declared as following:

void __stdcall Display(LVBoolean *Boolean, char Message[]);

and the error-message shows something like this:



I think, it is is important to consider the capital- letter in the function name, because this throws the exception. On the other hand the datatype "LVBoolean" can be found in the LV help as 8-bit integer as shown below.



Greets, Dave

Message Edited by daveTW on 01-16-2007 10:20 AM

Greets, Dave
Download All
Message 7 of 13
(5,456 Views)

thanks tst and dave... i think this may be the problem Smiley Mad ...

In LabVIEW, a Boolean is one byte. In Microsoft Visual Basic, a Boolean is two bytes. In Microsoft Visual Basic, if you declare variables as Booleans, the memory becomes corrupted or overwritten. Instead, you must declare each variable as one byte. The Booleans are passed by ref because they are set up as pointers to values.

quoted from: http://zone.ni.com/devzone/cda/tut/p/id/3188#toc1

although this is VB... but i think VB and VB .NET should be using the same data type.. if i succeed i'll inform you guys again... thanks a lot for the help... Smiley Very Happy

Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 8 of 13
(5,451 Views)


@JQ wrote:

thanks tst and dave... i think this may be the problem Smiley Mad ...

In LabVIEW, a Boolean is one byte. In Microsoft Visual Basic, a Boolean is two bytes. In Microsoft Visual Basic, if you declare variables as Booleans, the memory becomes corrupted or overwritten. Instead, you must declare each variable as one byte. The Booleans are passed by ref because they are set up as pointers to values.

quoted from: http://zone.ni.com/devzone/cda/tut/p/id/3188#toc1

although this is VB... but i think VB and VB .NET should be using the same data type.. if i succeed i'll inform you guys again... thanks a lot for the help... Smiley Very Happy



And in Win32 API a BOOL is 32 bit. It's amazing how even Microsoft can not decide what is best.

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 9 of 13
(5,439 Views)

thanks Rolf for pointing that out...

i've finally solved the problem (i think)... Smiley Very Happy 

it seems that VB .NET is much "smarter" compared to VB 6.0 as i do not need to convert the value to Byte before passing over the value Smiley Wink .. for some reason its seems as though i can declare the data type as Boolean and it still works to expectations Smiley Surprised ...

i'll post the codes here and if anybody is interested can take a look... if any bugs found please inform me and i'll do so if i found any... thanks to all who helped me out... great learning experience with you all Smiley Very Happy

Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 10 of 13
(5,415 Views)