LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a variable in dll?

Solved!
Go to solution

I have known how to call a function in dll with Library function node。

But the dll file I am going to use contains some variables which I need. But the LIbrary function would not work!

Would  Code interface node work? I have only a limited knowledge of C++. So I am wondering it.

 

Thx for any suggestion Smiley Happy

0 Kudos
Message 1 of 7
(5,421 Views)

Hi youminbuluo,

can you give some more informtation please? Is it your own dll? Can you change things inside of it? What have you already done?

 

Mike

0 Kudos
Message 2 of 7
(5,416 Views)

A CIN is a different beast. CINs are obsolete technology, so you should not use them unless you absolutely have to.

 

You cannot "access" variables inside of a DLL. You can only call functions. Furthermore, LabVIEW only handles C-type DLLs. If you are programming in C++ then you need to make sure you're correctly exporting the functions.  Have you looked over the LabVIEW Help? You should also read over this article: Writing Win32 Dynamic Link Libraries (DLLs) and Calling Them from LabVIEW.

 

0 Kudos
Message 3 of 7
(5,403 Views)

MikeS81. Yes, I have have give more details on this. But I was so sleepy yesterday.

I don't have the source code of the dll file. It is provided by hardware manufacture. I only have  .h, .lib and .dll file. It is thought to be enough,right?

 

I have post the h file here.

 

What I have done is wrap those functions like  "extern CIDLL_API BOOL WINAPI CIUsbLinked(void) " in labview. I can do that through Tool->Import->Shared Library(.dll). But to those variables such as "extern CIDLL_API BOOL UsbInited", I haven't figure out how to use them in my labview program. Those variables are important because they show the real time state of the hardware.

0 Kudos
Message 4 of 7
(5,380 Views)

Yes, I know that. I have read the first 14 chapters of LabView for everyone.Smiley Happy

The author has the same opinion with u. But I really have to use the dll which originally developed and used in Visusal C++

 

And for anyone who has the experience with such situation, I have attached the whole dll file and its demo, which is used in Visual C++. 

 http://dl.dropbox.com/u/396791/Eg.rar

0 Kudos
Message 5 of 7
(5,378 Views)
Solution
Accepted by topic author youminbuluo
You will need to create a wrapper DLL that contains functions that allows you to return the values of those variables. Your wrapper DLL would be used to call the functions in the manufacturer's DLL.
Message 6 of 7
(5,366 Views)

So much thanks!

It is exactly what I need to do and I have succeededSmiley Happy

0 Kudos
Message 7 of 7
(5,352 Views)