Martijn Posted November 29, 2012 Report Share Posted November 29, 2012 Hi all, I'm using VIPM to distribute a package that adds functionality to LabVIEW via a C library. This works fine under Windows as I simply distribute 32- and a 64-bit pre-compiled versions of the DLL in the package and get LabVIEW to load which one it prefers at runtime. I want to expand to Linux support, in which case the analog is a shared library, but then pre-compilation is undesirable and it would be better to create the library at install time. I'd imagine the correct thing to do in this situation is to create a post-install VI script to run GCC and compile the source for the host machine; has anyone done this before? Cheers, Martijn Link to comment Share on other sites More sharing options...
Jim Kring Posted November 29, 2012 Report Share Posted November 29, 2012 Hi Martijn, Yes, I think you could add a post-install custom action VI that compiles your shared lib via the command line at install time. But, would configuring the Call Library Function node with a .* (instead of ".DLL") file extension maybe solve your issue? What I mean is that, if you have the platform-independent shared libraries in the same folder and use the ".*" convention in the CLF node, then LabVIEW will load the right one for the target platform? For example, you could put "mylib.dll" (Windows) and "mylib.so" (Linus) side-by-side. See this doc for more info: http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcodeconcepts/configuring_the_clf_node/ I hope this helps, -Jim Link to comment Share on other sites More sharing options...
Martijn Posted December 1, 2012 Author Report Share Posted December 1, 2012 Hi Jim, Looks like the Post Install Action is indeed what I want. The logic I've gone with is the check the "Files Installed" attribute for the source file to be compiled, and if found, use that path to execute the gcc call in the correct directory. My initial attempt used "Folders Created" to get the base dir but this did not seem to work when upgrading a package because I'm guessing the folders themselves are not recreated, but I think this works much better. I am indeed using the .* convention of the CLN to pick the relevant library, which seems pretty convenient. I was just wondering if there were any unintended side-effects I should be aware of using this on other platforms than Windows. In particular I'm not clear on how it distinguishes 32/64-bit on Linux. Sadly I do not have a Linux license so I can't directly test myself. Cheers, Martijn Link to comment Share on other sites More sharing options...
Martijn Posted December 1, 2012 Author Report Share Posted December 1, 2012 In particular I'm not clear on how it distinguishes 32/64-bit on Linux. Actually, I presume the lib*.* convention works the same on all platforms so I suppose I could distribute cross-compiled versions for each permutation. It will probably work but it'd be nice to get a Post Install Action to do it for me Link to comment Share on other sites More sharing options...
Jim Kring Posted December 1, 2012 Report Share Posted December 1, 2012 Thanks for the response. I'm glad this looks like a good solution. Let us know how it goes! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.