LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build failing trying to copy Windows system dll

Good Morning,

    I'm having some problems trying to build an "exe" of my current project. The build starts and then fails pretty early, indicating that it can't copy the Windows "kernel32.dll" to the build's support folder. As I am building this exe to run on the machine that it is being built on I have no desire to copy that dll, nor any of the others, but I can not remember, nor figure out how to tell the build to leave it alone. I don't know if it will have the same problem with the others, installed when various instruments, etc. were installed. I just want to be able to go to an exe and get the development version off of the system, before some curious technician decides to "learn" LabVIEW and messes up the program (I used to be that technician!).

 

 Thanks,

 

Putnam Monroe

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 1 of 10
(4,559 Views)

Also happened with me some time ago. The reason was that full path to kernel32.dll was entered in DLL call and no PATH variable was set to Windows\System32\ folder. Then copy of kernel32.dll was copied to \data folder. Since that I never select kernel32.dll from System32, but only type "kernel32.dll", user32.dll, etc, and problem goes away. Something like that. Don't remember which LabVIEW it was - somewhere between 8.2 - 8.6.

 

Andrey.

 

0 Kudos
Message 2 of 10
(4,550 Views)
I'm not sure I understand. Which Path variable? I don't want it to copy the Windows system .dll, but if that is required then I guess I will.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 10
(4,530 Views)
<bump>    Still not understanding how to eliminate the problem, can't build an .exe at the moment. Not able to try it out at the moment, customer site is an hour and a half drive from here, won't be there until Saturday, so I won't be able to ask questions then. Just want to convert what is on the system, running in the development system, to an exe.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 10
(4,503 Views)

Normally LabVIEW should not make a copy of DLLs from System32 directory to the targed directory in case if kernel32.dll called simply like this:

 

Kernel32dll.png

 

 

 

Then kernel32.dll will be not copied to data folder (was not created in my case):

 

NoData folder.png

 

 

but if you perform call like this:

 

Kernel32dllwithpath.png

 

Then LabVIEW will make a copy of kernel32.dll in the data folder:

 

Data folder present.png

 

 

 

So, you should be sure, that all kernel32.dll calls performed without full path to C:\Windows\System32.

What also may happened - kernel32.dll was "relinked" to data folder, like this:

 

Kernel32dllwithpathlinktodata.png

 

Of course, this is totally wrong (and then error occurred by build).

 

Also you can check dependencies list:

 

depend.png

Hope it helps a little bit.

 

 Andrey.

 

 

Message 5 of 10
(4,498 Views)
LV_Pro-

The reason why the exe is copying the dll is so the exe will run on any system.  The way around this behavior for dlls in the System32 folder is to not include the full file path to the dll.  Any dlls in the system32 folder do not need the full file path to them.  LabVIEW knows which dlls are there and how to find them.  Therefore when using the Call Library Funtion Node, simply put “kernal32.dll” in the “Library name or path”.  This will not make a copy of the dll in the data folder.
Regards,

Mike S
NI AE
Message 6 of 10
(4,498 Views)

Thank you both for clarifying the issue, particularly Andrey for the wonderfully illustrated tutorial! This is why this is such a powerful forum, one that I recommend to all the LabVIEW programmers, new and not so new, the knowledge as well as the work that sometimes goes into an answer. I'm not sure where in my code I'm making that call, this project has been going on for several months, with some of the code being legacy from previous projects, although I don't think that is where this problem came from as I haven't run into it before.

 

Thanks again. I will mark it answered once I have actually built an .exe.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 10
(4,480 Views)

I have same problem.

 

I try to fix incorrect calls to kernel32 as described above.

I right click on kernel32 in dependencies and press Find\Callers. LV find some VIs and I check calls of kernel32 in this VIs. In one VI I find incorrect call to kernel32 (with path) and fix it (remove path). But after that compiling error still present. May be I dont find all calls to kernel32? But project very big and i dont know other way to find calls to kernel32 except from dependencies.

 

OS Win7 pro 32

0 Kudos
Message 8 of 10
(3,964 Views)

I'm not sure that you've provided enough information for us to narrow down the issue.  What error message(s) are you recieving, and do you know which .dll's used in your project are making calls to kernel32?  Also note that this thread is a few years old and you might get a more active discussion by posting a new thread on this.

0 Kudos
Message 9 of 10
(3,944 Views)

I ran into the same issue, the build was copying the Kernel32.dll to the build folder. By calling it only by its name (kernel32.dll) on the LibraryCall fixed the issue.

 

Thanks!

0 Kudos
Message 10 of 10
(3,869 Views)