LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error linking generated code

I am writing a dll in LabWindows, which is calling another dll written in C++ (using Visual Studio 2005).  I can build the dll in LabWindows, but when I try to run, I get "Error linking generated code".  I did add extern "C" to all C++ dll exported functions.  I can call my C++ dll from another C++ application but not from LabWindows.  Using Dependency Walker, I can see that my C++ dll depends on MPR.dll.  Dependency Walker is issuing the following warning: "At least one module has unresolved input due to a missing export function in a delay-loaded dependent module", could this be the problem?  I am using LabWindows 8.0.1
0 Kudos
Message 1 of 9
(4,632 Views)
Hi there,

Is the C++ dll that is being called an mfc dll?  I would recommend trying to create a very simple dll in Visual Studio and make sure you can get this to work in CVI.  Is there any more information in the erorr message?  Or does it just say Error linking generated code?  If you can give us a small example that demonstrates the error, we can take a look at it here.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 2 of 9
(4,587 Views)
Pat,

Thanks for the reply.  Dll is a mfc dll (Is that a problem?).  I don't have any more information on this error message.  I was able to create a simple C++ dll and get it to work with CVI.  But I can't get this mfc dll to work with CVI.

Thanks


0 Kudos
Message 3 of 9
(4,583 Views)
Hi,

Would it be possible for you to post how you are calling the dll in CVI?  Are you using LoadLibrary to dynamically load it or statically loading it into the project?
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 4 of 9
(4,546 Views)
Hi Pat,

I am calling the mfc dll by adding .lib file to the CVI project.

I get "Error Linking Generated Code" only when I try to run my CVI dll (which calls the mfc dll) from the Function Tree(.fp) file.  I do not get any error if I create another project in the same CVI workspace and then call the CVI dll.  I have written many CVI dlls in the past and tested in using .fp file.  The only difference this time is that I am calling a mfc dll.

I guess I can test my CVI dll by writing a tester program, but it sure would be nice to get it going with .fp file.


Thanks
0 Kudos
Message 5 of 9
(4,543 Views)

Might it be that MPR.dll is not found when running the fp, because it isn't  installed to a path ,where Windows searches it  ?

AFAIK Windows searches only  the Windows installation directories and the current directory ( where the application is started from) for DLLs.

 

 

0 Kudos
Message 6 of 9
(4,532 Views)

Markus,


Thanks for the reply.  I have MPR.dll in C:\Windows\System32 folder and it still comes up with "Error linking generated code".  I added MPR.dll in my CVI project folder, same result.

0 Kudos
Message 7 of 9
(4,519 Views)
I believe the additional information about creating an fp might have given a clue as to why this is occurring.  There is a good knowledgebase here that describes the same errors you are receiving.  I believe the problem is coming from static libraries that are not being linked in when you call it from your function panel.  Hope this helps!
Pat P.
Software Engineer
National Instruments
Message 8 of 9
(4,505 Views)
I can't believe it. It works !  Thank you Pat. You the man.
0 Kudos
Message 9 of 9
(4,499 Views)