LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

including dll's in exe

I have a program that makes use of the WinPCAP driver.  I'm leveraging off of a packet capture example available from NI.  Their example (available here: http://www.ni.com/example/27660/en/) uses a dll they named lvwpcap.dll.

 

I downloaded their example, along w/ the WinPCAP driver itself, to my machine.  In my program I'm using the functions included w/ lvwpcap.dll with no issues.  I can launch my program and tx/rx packets.

 

I'm now trying to create an exe.  In the build spec properties, I specifically include this dll as a source file.  However, when my co-worker runs the exe, it asks for the location of the dll.  Why is this happening, considering I've included it in my build?

 

Thanks in advance

0 Kudos
Message 1 of 3
(3,977 Views)

Including the DLL in the build means that the file will exist on disk, but that doesn't mean the executable will know how to find it. The DLL must be in the search path, which is described here: http://msdn.microsoft.com/en-us/library/7d83bc18.aspx If your build places the DLL somewhere else, the application won't know how to find it, even though it is available on disk.

0 Kudos
Message 2 of 3
(3,974 Views)

@bmishoe wrote:

I have a program that makes use of the WinPCAP driver.  I'm leveraging off of a packet capture example available from NI.  Their example (available here: http://www.ni.com/example/27660/en/) uses a dll they named lvwpcap.dll.

 

I downloaded their example, along w/ the WinPCAP driver itself, to my machine.  In my program I'm using the functions included w/ lvwpcap.dll with no issues.  I can launch my program and tx/rx packets.

 

I'm now trying to create an exe.  In the build spec properties, I specifically include this dll as a source file.  However, when my co-worker runs the exe, it asks for the location of the dll.  Why is this happening, considering I've included it in my build?

 

Thanks in advance


lvwpcap is simply a wrapper DLL that wraps the WinPCap API into a more LabVIEW friendly API. It does not contain the WinPCap driver at all. This WinPCap driver consists of a user space DLL that typically gets installed in your System folder and a kernel device driver component.

While you could include the user space DLL into your application too, that is usually a pretty bad idea. The kernel device driver you can't include intelligenlty into the application install anyhow. This needs various registry settings that the WinPCap installer is the most authoritive instance to know about.

 

So in order for your LabVIEW application using the lvwpcap DLL to work, your coworker and anybody else will have to install the WinPCap package with the official installer.

 

Without that driver installed, loading of the lvwpcap DLL will fail. LabVIEW doesn't know about secondary dependencies of DLLs. All it does is telling Windows to please load the lvwpcap DLL. Windows then sees that it depends on other DLLs, tries to load them and when one iof them is failing for whatever reason, will simply tell LabVIEW that loading the lvwpcap DLL failed. LabVIEW treats this error as general error simply returning the error that the DLL couldn't be loaded. It does not have different error codes for the DLL not found and DLL not loadable situation, but that is anyhow a minor detail.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(3,936 Views)