12-03-2014 09:55 AM
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.
12-03-2014 10:17 AM
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.
12-03-2014 10:28 AM
Don't you have to register the DLLs?
12-03-2014 10:28 AM
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
12-03-2014 10:40 AM
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.
12-03-2014 11:03 AM
12-03-2014 11:13 AM
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.
12-03-2014 11:17 AM
12-03-2014 11:19 AM
In case that answer wasn't clear enough...I installed WinPCAP driver months ago.
12-03-2014 11:27 AM
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.