LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

code works until I build exe

I am making use of a couple DLLs in my code.  They act as wrappers for the WinPCAP driver and allow me to tx/rx packets to a piece of hardware.

 

This all works perfectly fine in my development environment.  However, when I build the exe, it stops working and I cannot determine why.

 

I'm positive the exe finds the DLLs (I had a separate post about this a couple days ago) for a few reasons:

1. I put the DLLs in the same directory as the exe (in which case it never even asked me to browse for them because that's the first place it looks)

2. To test, I put the exe on my desktop and it asked me for location of DLLs, which I browsed to.

3. Like I said I have 2 DLLs...the first one (from NI's packet sniffer example) I use to discover what network adapters I have.  I know this is working in the exe because it generates a different pcap reference number as I click around and select different adapters.

 

The PCAP Write function is pretty barebones...it has a string input, and a single error bit output.  To test that it's being executed, I set the value of the error bit high (which means errored) by default, then tx-ed some packets and watched the error light go off.  I don't have access - that I know of - to dig any deeper into this function because it's just a Call Library Function Node.  Furthermore, like I said, this code all works 100% fine when I run from my dev environment.

 

Thanks in advance for any help.

0 Kudos
Message 1 of 16
(3,436 Views)

to add some more details...when I say "it's not working", the way I test is to use wireshark to monitor my network adapter.  When i run the code from my dev env, as I click "write" I see the packet show up in Wireshark.  When I build the exe, no packet ever shows up when I click "write".  That's the reason I mentioned the PCAP Write function, as it's the first thing I notice is not working.

0 Kudos
Message 2 of 16
(3,418 Views)

Don't you have to register the DLLs?

0 Kudos
Message 3 of 16
(3,407 Views)

Do you have any error handling in your program? Are you getting any errors?

 

Have you tried compiling with debugging enabled and using the remote debugger? 

 

Search in help for "Building and Distributing Applications" and read the section on Debugging Applications and Shared Libraries

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 16
(3,406 Views)

To answer your question about error handling, the library function node that the PCAP Write function uses has a "write error" output.  Based on the tests I did, that error is '0' (i.e. no error).

 

I tried to add a labview-level error handler, but the original C code doesn't have an additional error output.  When I tried to add an error output, I got errors because now the I/O listing didn't match between the C code and labview.

 

I'm not getting any labview errors when i click "write"...I would think that if it couldn't find the function, that's the kind of error that would pop up on the screen (i.e. a 1097 error).  In other words, from an outside look, everything seems fine...but somewhere at a low level, it's not actually writing the packet.

0 Kudos
Message 5 of 16
(3,387 Views)
Did you actually do what was recommended in your duplicate post - http://forums.ni.com/t5/LabVIEW/including-dll-s-in-exe/m-p/3059473? It's not enough to simply copy a dll. Run the installer for winpcap to make sure that you have all of the dependencies.
0 Kudos
Message 6 of 16
(3,376 Views)

That was not necessary to try, because that was not the problem.  If the WinPCAP driver was not installed, then the code wouldn't work regardless of whether it was run from the dev environment or the exe.

 

It's not a duplicate post because it's a different issue.

0 Kudos
Message 7 of 16
(3,371 Views)
It's certainly looks like the exact same question to me and since you have not tried installing the low level driver as recommended, how can you say it won't work. You had to download it on your development pc so do the same thing on your deployment.
0 Kudos
Message 8 of 16
(3,367 Views)

In case that answer wasn't clear enough...I installed WinPCAP driver months ago.

0 Kudos
Message 9 of 16
(3,364 Views)

I'm not sure how you could possibly arrive at that conclusion.  My previous post says, "when I try to run the exe, it says it can't find the dll."  That problem was solved by the user who linked the windows article that specified where Windows looks for dlls when an exe is calling them.  Furthermore, in my first post in this question, I specifically mention why I know for sure the dll is being found.

 

I never mentioned a "development vs. deployment" pc because they are one in the same.  I built the exe and placed it on the same machine I develop on.

0 Kudos
Message 10 of 16
(3,356 Views)