LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the DLL function executed by call library node fail when the Vi is re-opened?

Solved!
Go to solution

Development System

OS: Windows XP

LabVIEW: version 10.0

DLL: Custom 

Compiler: Visual C++ 6.0

Function Prototype: __declspec(dllexport) const char * test(void)

 

 

We have developed a DLL for use.  The DLL compiles cleanly.  The DLL includes a function test.  The test function validates the functional capabilities of the DLL.  I have followed the examples online, and I have used the import shared library tool in LabVIEW.  The VIs created use the call library node. 

 

When I create a VI calling the test function from the custom DLL using the call library node the VI executes the DLL function test flawlessly.  I close the VI.  When I re-open the VI and run it, I get an error code from the DLL.  However, if I go to the block diagram and set the path for the DLL in the configure call library node again then the VI executes the DLL function test flawlessly again. 

 

I have to set the path for the DLL in the configure call library node every time I open the VI.  The examples I downloaded from the community do not require this.  What might the DLL be missing?  What am I missing? 

 

 

 

 

         

 

0 Kudos
Message 1 of 7
(2,704 Views)

@TaurusTiger wrote:

When I re-open the VI and run it, I get an error code from the DLL.


What is that error code? And what that error code mean? Can you give bit more detailed information?

 

Trying to help,

Mathan

0 Kudos
Message 2 of 7
(2,697 Views)

The error code is a const char * returned by the custom DLL function called test.  The error code indicates the test function fails the first test.  The first test attempts to use the embedded Python to execute an import statement.  When the test function fails it returns the Python statement and on success it conducts the other similar tests. 

 

               

0 Kudos
Message 3 of 7
(2,694 Views)

Here is an additional twist to the problem:

 

If I open the VI, run it, and then configure the DLL path for the call library function node, then I get the DLL function test error response returned both times and every time I run the VI after that, while the VI is open.  If I close the VI, open it, set the DLL path for the call library function node then the DLL function test returns success.  

0 Kudos
Message 4 of 7
(2,678 Views)

I think it was rather unfair of me to ask for help with my DLL issue without disclosing more detailed information.  As a corrective action, I have attached a zipped file.  The zipped file contains the entire VC++ 6.0 project for compiling the DLL, the DLL, and the VI I have been using to test it. 

 

###NOTE####

 As a prerequisite to compilation and usage of the DLL you'll need to have installed Python 26 on your system.   

 

You may obtain the MSI for correct version of Python from the following location:

http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi

###NOTE###

 

Thank you very kindly for any assistance offered!

 

Thanks,

Bill

0 Kudos
Message 5 of 7
(2,663 Views)
Solution
Accepted by topic author TaurusTiger

I solved the issue.

 

I had to create the DLL using the following steps for VC 6.0:

 

1. New project

2. Select the MFC Appwizard(DLL)

3. Select the Regular DLL using shared MFC DLL

4. Yes for source file comments

5. Finish

 

The DLL must be on the VI search path.  The simplest way was to have the DLL in the same directory as the VI.

 

   

 

 

0 Kudos
Message 6 of 7
(2,645 Views)

Many thanks for posting back how you solved it out. This will help somebody in future. Thanks.

 

Mathan

0 Kudos
Message 7 of 7
(2,636 Views)