取消
显示结果 
搜索替代 
您的意思是: 

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 难过表情 ...
 
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 极度高兴的表情 ...
 
attached is a simple code... hope i did it correctly... 冷淡表情
Best Regards,

JQ

LV 8.0 user...
0 项奖励
1 条消息(共 13 条)
5,657 次查看

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 项奖励
2 条消息(共 13 条)
5,643 次查看

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 难过表情 ...

Best Regards,

JQ

LV 8.0 user...
0 项奖励
3 条消息(共 13 条)
5,638 次查看

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!
4 条消息(共 13 条)
5,640 次查看
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 项奖励
5 条消息(共 13 条)
5,630 次查看
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 项奖励
6 条消息(共 13 条)
5,623 次查看
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
下载全部
7 条消息(共 13 条)
5,621 次查看

thanks tst and dave... i think this may be the problem 生气表情 ...

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... 极度高兴的表情

Best Regards,

JQ

LV 8.0 user...
0 项奖励
8 条消息(共 13 条)
5,616 次查看


@JQ wrote:

thanks tst and dave... i think this may be the problem 生气表情 ...

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... 极度高兴的表情



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
9 条消息(共 13 条)
5,604 次查看

thanks Rolf for pointing that out...

i've finally solved the problem (i think)... 极度高兴的表情 

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 眨眼表情 .. for some reason its seems as though i can declare the data type as Boolean and it still works to expectations 吃惊表情 ...

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 极度高兴的表情

Best Regards,

JQ

LV 8.0 user...
0 项奖励
10 条消息(共 13 条)
5,580 次查看