LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Run-time DLL in CVI 8.0

Solved!
Go to solution

I never work bevore with DLL but I want to learn it. So I create without big problems a program with a static DLL in LabWindowCVI 8.0
Now I want understand the handling of dynamic DLLs. I read this (http://digital.ni.com/public.nsf/websearch/8AE57BDA995ACCB486256AEA0062B3C6?OpenDocument) article and build my own program like the example but it does not work and show many errors. I have only changed myFunction and MYDLL.DLL with my own names. CVI seems not understand the instructions.

It could be that I understand the instruction wrong. I do not realy understand the wxample code. Can you help my and explain it esay?

0 Kudos
Message 1 of 6
(4,106 Views)
Solution
Accepted by susay

Hi Susay,

As a first step, you need to include the stdio and windows headers to get access to the Windows SDK functions that you will need for the dynamic DLL call:

First you load your dll - Make sure that you pass a correct file path to the LoadLibrary function.

Then you find the function in the dll by calling GetProcAddress and passing the function name you would like to call.

Then you can call the function by using the typedef'd function pointer. (You would have to define one for each function to call)

 

You should start by using an example, which you can find here: Calling a DLL in CVI: Explicit Linking vs. Implicit Linking (Dynamic vs. Static)

The example is explained on this page: Calling a DLL in CVI (Tutorial). These pages also contain links that may help you decide which linking method to use.

 

Don't hesitate to ask if other questions arise. Good luck!

 

Peter

 

 

 

 

 

 

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 2 of 6
(4,088 Views)

The correct header files are included. All file are in the same folder so the DLL file path is only the dll name.

I would test the Dynamic vs. Static sample but the download do not work. I tried it yesterday, too. A sample like this not exist on my computer. I need the download zip 😞

0 Kudos
Message 3 of 6
(4,082 Views)

Hi Susay,

You need to be logged in to download the file. I was able to download the project without problems. You can try this direct link.

 

-Peter

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 4 of 6
(4,066 Views)

The link do not run at work. I have dowloaded the file from elsewhere. With the sample I have a base. Now I try to comprehend the code step by step. At the moment thank you for your help.

0 Kudos
Message 5 of 6
(4,015 Views)

Good luck with the files. If you need more help, don't hesitate to use our forums again!

 

Peter

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 6 of 6
(4,013 Views)