LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

openG Zlib library not working in Labview 2018 64bit

Solved!
Go to solution

I have just started migrating an application to 64 bit, hoping to get access to more memory. The code runs, which is good. However, I need to also implement code that decompresses gzipped data. I ran my proof of concept in 32 bits and got it working beautifully, using the OpenG ZLIB library.

However, the zlib library is broken in LV2018 64 bits! The dll in C:\Program Files\National Instruments\LabVIEW 2018\user.lib\_OpenG.lib\lvzip\ is 32 bits and cannot be called, breaking the code.

 

I read in this thread that Rolf was working on a fix back in 2012. Is there something I can do about this?
Or is there another library that supports gzip in 64 bits?

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 1 of 30
(6,288 Views)

https://www.7-zip.org/
Can be run through commandline

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 30
(6,284 Views)

This is a long shot, but have you tried installing the OpenG libraries into LV 2018 64-bit?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 30
(6,272 Views)

I installed the OpenG tools with VIPM. I have all the ZLIB VIs in the pallet. Unfortunately they are broken due to a 32 bit underlying dll.

 

Thank you for the 7zip suggestion. Unfortunately it would be a major compromise: I have to deflate gzipped http data and for efficiency sake I would much rather do that in memory.

 

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
Message 4 of 30
(6,243 Views)

Maybe a .net stream-object?

https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.gzipstream?view=netframework-4.7.2

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 30
(6,239 Views)

The dll you're looking for is the same one I'm using for the PDF Toolkit.

 

So you'll need that 64 bit dll. IIRC, the 64 bit dll I found online somewhere (will look where), uses WinAPI iso C calling convention. I only use one function (from libz, not LVZLib, but that's the same dll).

 

I'm not sure how much work it would be to change all calling conventions for each function in LVZLib…

 

At some point, I asked the makers of the zlib dll if they could put a pre-compiled 64-bit dll online. They said they liked the idea, but they didn't let me know if they ever did it (not did I asked again).

 

Some functions, even if we can get a 64-bit pre-compiled dll, might need adaptation to deal with proper pointer sizes. This might not be needed, as most functions will probably pass arrays\strings anyway, so the pointer size will automatically adapt.

 

EDIT: Just recalled that there is a widely available 64-bit dll available, but the version has a bug, making it not compress on Windows. I had to look long and hard for a more recent version, but I could only find one that had the changed calling convention... I think we need someone to recompile from source code...

Message 6 of 30
(6,237 Views)
Solution
Accepted by topic author aartjan

No it's not the same DLL at all. I do use the zlib library in its core but the ZIP archive handling is not standard included in the normal zlib DLL.

 

Here is a beta version of the LabVIEW ZIP Library that does contain 64 bit support. For Windows it works fine, for the 64 bit Linux variants there seems to be a strange bug that treats directories somehow as files when zipping up a file.

 

I'm currently working on a new release for this library that should work for all platforms on which LabVIEW is available.

 

And yes the old zlib library used the standard calling convention, then they changed it to cdecl for all platforms. Not sure if they changed it back again. It was one of the reasons I initially decided to create my own version for the OpenG library together with the fact that I also wanted to have the ZIP handling code in the same DLL/shared library. I found it pretty stupid to have to create conditional VIs just for the sake of interfacing to standard calling convention on Windows and cdecl on all other platforms and at that time there was no conditional compile structure at all, not even as undocumented feature. That only came to life in LabVIEW 7.x.

Rolf Kalbermatter
My Blog
Message 7 of 30
(6,221 Views)

@rolfk wrote:

No it's not the same DLL at all. I do use the zlib library in its core but the ZIP archive handling is not standard included in the normal zlib DLL.


Ah. I was to hasty. Both work for me, as I only use the deflate function.

 


@rolfk wrote:

 

And yes the old zlib library used the standard calling convention, then they changed it to cdecl for all platforms. Not sure if they changed it back again. It was one of the reasons I initially decided to create my own version for the OpenG library together with the fact that I also wanted to have the ZIP handling code in the same DLL/shared library. I found it pretty stupid to have to create conditional VIs just for the sake of interfacing to standard calling convention on Windows and cdecl on all other platforms and at that time there was no conditional compile structure at all, not even as undocumented feature. That only came to life in LabVIEW 7.x.


How does that work on Linux systems? AFAIK, There's a zlib dll in the OS. Should programs using it test what the version is, before calling each function with either standard or cdecl? How would the application know what to use for future versions?

 

If it's a problem in LabVIEW, how do other applications deal with that? Sounds like a terrible thing to change.

0 Kudos
Message 8 of 30
(6,196 Views)

wiebe@CARYA wrote: 

How does that work on Linux systems? AFAIK, There's a zlib dll in the OS. Should programs using it test what the version is, before calling each function with either standard or cdecl? How would the application know what to use for future versions?

You don't have stdcall convention on non-Windows (32-bit application mode) systems. So on Linux it is always cdecl. And on Windows 64-bit (for 64-bit applications) you only have fastcall (first 4 paramaters, except if they do not fit in 8 bytes, are passed through registers with shadow locations on the stack too, rest is passed only on stack).

 

If it's a problem in LabVIEW, how do other applications deal with that? Sounds like a terrible thing to change.


They changed the DLL name from zlib.dll to zlib1.dll for the cdecl version. Still since the name is not the same as under other OSes, you can not use the wildcard library name pattern in the Call Library Node (zlib1.*) where LabVIEW will automatically replace the * with the correct file ending for the actual platform.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 30
(6,189 Views)

Wow, you guys really go to the bottom of things! Smiley Surprised

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 10 of 30
(6,182 Views)