08-17-2010 09:52 AM
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?
Solved! Go to Solution.
08-18-2010 03:48 AM
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
08-18-2010 05:12 AM
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 😞
08-18-2010 06:23 AM
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
08-20-2010 03:50 AM
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.
08-20-2010 04:05 AM
Good luck with the files. If you need more help, don't hesitate to use our forums again!
Peter