Lazy DLL loading in native image with Micronaut, JavaFX and GluonFX - graalvm

I have an app built in java with Micronaut and JavaFX, which is compiled to native using GluonFX.
This app is used for multiple purposes, one of them is a specific Switch configuration.
To perform the Switch configuration I needed to integrate a native library (made it with graalvm.nativeimage). And also the driver NPCAP is required to be installed in the PC.
Problem:
With GluonFx I can only link the .lib library, and this library will require the .dll and the .dll associated with NPCAP.
Now when I try to run the APP in a PC where NPCAP is not installed, it will not boot, complaining for missing .dll
Question:
Is there a way, these libraries fail only when required to be used? I mean, when the app tries to acced it? In that way I can still using my app for the original purposes without install NPCAP
Thanks in advance

Related

How to include a gigantic 14GB+ folder in the NSIS installer of an Electron app?

I have an app made using Electron. I am creating the NSIS installer for the app using Electron Builder. The Electron app has a dependency to something similar to a videogame (lets call it a videogame but it's not a videogame) that is 14GB+ folder and contains large binaries (.dlls, .exes, etc.).
I need to create the NSIS installer for my app so the user installing the app gets both the app and the videogame dependency completely offline, without internet.
I am aware the NSIS installer cannot be larger than 2GB.
A solution I am thinking of:
Create a install.zip that contains NSIS installer and videogame.zip.
In the .nsh script, extract the videogame.zip via relative path to wherever I need the contents
I wasn't able to solve this problem. I just used an alternative: I used a .zip file instead of NSIS.
I included both the dependency and the Electron app together.

Bootstrapping a NW.js / Electron application

I am building a HTML/JS/CSS application that I would like to distribute packaged either as a NW.js or Electron app. I am new to both, and have read that the packaged executables can be quite large. Since the application would be free, I find that the cost of distributing it from a CDN to be too high.
I was wondering if there was any installer that allowed the "standard" parts of the executable (the Chrome components, etc.) to be downloaded as a shared library from a free CDN, as part of the app's installation / first execution?
With either one, you could host the packages on Github using the "releases" feature, which is free. This is a common approach for a lot of open source Electron applications.
Here are some examples of this being done:
yoda
Caprine
Here is the official documentation on Github releases.
There is a module for Electron designed to make this easy called electron-gh-releases.

Does App Store accept Qt app linked with QT Library LGPLv3

There is any way to submit to the App Store an Qt Quick Controls application
under LGPLv3 license without violating App Store rules?
What i want to do is to deploy my app on iOS store using a dynamically linked version of the Qt libraries.
I tried to find an answer in every forum but seems very difficult.
Any suggestion is very appreciated.
Thanks in advance.
App Store does not care which license you use. It is the users of your application and the Library authors who care. The main point of the LGPLv3 license is that the end users must have the possibility to replace the library with their own modified version. This is very important to understand, dynamic / static / everything else is just distracting.
Let's move to Qt. It is available with LGPLv3 license on major Desktop (Windows, OSX, Linux) and mobile (iOS, Android) operating systems. Suppose you develop an application and want to keep your source code closed. On the Desktop you can link dynamically to Qt libraries. When the end users install your application, they can replace Qt libraries in the following way:
Compile their own version of Qt libraries
Navigate the the location where the application is installed
Replace original Qt libraies that were shipped with your applicatoin with their own modified versions
Looks easy, right? The main goal of LGPLv3 is achieved. The user can replace libraries.
Moving to the mobile platforms, starting with Android. Even though you link dynamically to the Qt libraries, we now have a small problem. The user can not navigate to C:/Program Files/YourApp and replace Qt libraries, because it's Android. Rooting is not an option, since it doesn't work on every device (and might not be legal). Remember, the main goal of LGPLv3 is to give the users ability to replace the library and run the modified version of your application on their device.
Solution? Provide .apk file to every user who installed your application with detailed instructions on how to:
Unpack your .apk file
Replace Qt libraries
Zipalign / pack / signtool to a new .apk
Install .apk with modified Qt libraries
Let's talk about iOS. Many say it is not possible to use LGPLv3 with iOS because of static linking. Wrong. Again, you just need to give the end user the possibility to replace Qt libraries. How? Provide your object files for the end user to relink. Or even better, put all your application code and resources in a separate Qt Quick plugin which will compile in a static library archive (technically just all object files concatenated together) for iOS. Then for every user who installed your application you have to provide instructions on how to replace Qt libraries:
Download project files and object files from your website
Download XCode and developer tools from Apple website
Replace Qt libraries
Deploy application to your device
Before this was not possible because in order to deploy on the device the user had to enroll Apple Developer Program. But this is not the case any more. You can launch your app on a device using a free Apple ID account
The end user rights are protected. They can replace Qt libraries. Just make sure you do required steps:
Mention in your application that you use Qt libraries and also mention you use them under LGPLv3 license. Provide a link to LGPLv3 lincese.
Make sure your setup of replacing Qt libraries work. Set up a clean virtual machine and do everything step by step. Document it for the end users.
When the users who downloaded your application want to replace Qt libraries, provide them everything so they can do it.
Actually I don't think anyone would care. But you have to be ready just in case. Do not scream you use Qt LGPLv3 on Qt forums, but make sure you have it visible somewhere down in your application's "About" screen. Qt company does not have resources to scan every application from the App Store if it uses Qt or not. Neither they will touch you if you are a small-near-zero-profit. They have more important things to do.
It is very dissapointing however to see absolutely no help from people who work in Qt on the LGPL subject. Most likely all developers were instructed to answer "IANAL, please contact our legal department". The legal department will tell you - buy our commercial license, it's the only option. On the Qt website you can find Obligations of the LGPL. I am not surprised, there is no word about static linking and providing object files for re-link on this page. Qt company simply prefers not to tell anyone it is possible.
From my point of view LGPL was a huge step which enabled a lot of application to use Qt without disclosing their source code bringing huge popularity to Qt. Not to mention Nokia was the one who sponsored Qt on Mobile first (Symbian and then MeeGo).
Also thinking about MeeGo and Blackberry, there was no problem with developing closed source mobile apps that use Qt and publishing them in respective app stores. No commercial license needed.
Update:
This has been done before. LGPL is possible with static linking and App Store. https://news.ycombinator.com/item?id=4302517
In case the question gets closed as off-topic, I copied the answer here
https://opensource.stackexchange.com/questions/6463/in-2018-if-i-use-c-qt-5-10-0-to-build-a-closed-source-application-requires-ope/6495#6495
Yes, it's possible.
You can use this Qt app template:
https://marketplace.qt.io/products/qt-lgpl-app-template
On IOS it's impossible to relink the App, so it's LGPL V3.0 incompatible (user can't replace Qt libraries)
But this template generates a redistributable .zip Qt project on every rebuild.
Their entire private project is distributed in a compiled .a library, so a user can open project in Qt Creator, rebuild their application and load it on their ipad / iphone, and your source code stays protected
Note: If you are using the qtquick compiler, you must relink it to the same version of Qt.
This .zip file can be uploaded to your own URL or you can add it to your software resources.
You can use the same template in an Android app, a static Windows app, etc.
It's the same as #psyched says, but 100% automatically.

Add .dll files to application

In my application (build with Delphi XE8) I use the IdHTTP component. When I tried to run the application, the following exception was thrown: 'Could not load SSL library'.
I solved this issue by downloading the OpenSSL library from this site
http://thundaxsoftware.blogspot.nl/2014/09/cannot-load-ssl-library-using-delphi-xe7.html
If I'm correct: the files 'libeay32.dll' and 'ssleay32.dll' are needed.
But it only works for me. A friend of mine, who also uses this application, got the same error ("Could not load SSL library").
I want others to be able to download my application without them having to download the OpenSSL library seperately.
Is it possible to include these two files into my application?
For example by adding a folder to the directory location of the application? If so, how can I make the application find these files when it needs them?
I hope you can help me! (My apologies for the bad English)
You should bundle the DLLs (and any other necessary files) with your application in an installer. The installer can then install the DLLs in the same folder as your application executable, and your app will be able to find them when it's run. It also makes it much easier for your users to get the files into the proper locations by simply running Setup.exe (or YourAppSetup.exe).
There are several products that will create the installer for you, including the free (written in Delphi) Inno Setup.
The cleanest way to handle this is to deploy the SSL DLLs to the same directory as your executable file.
Assuming that you do not specify a location for the libraries, Indy will default to using the system DLL search order. And the executable file's directory is the top of that search order. So your DLL files will be found.
By supplying these libraries your app is isolated from other applications. That avoids so-called DLL hell where multiple applications share libraries but all have different version requirements.

Missing dependency for .ocx on Windows CE 6.0

I'm trying to make an ActiveX control for an application on a Windows CE 6.0 device, but I can't get it to register on the device. When I transfer the .ocx file over to the device and try to register it using regsvrce.exe, it fails with error 7e, which I've learned means a dependency is missing. How can I identify which dependency is missing? Alternatively, have I gone about creating the ActiveX control wrongly?
I have loaded the .ocx in Dependency Walker on my development machine (running Windows 7 64-bit, if that matters) and all of the top-level dependencies it lists are present on the CE device. I can't check further down the tree since Depends then looks for the top-level dependencies on my development machine, half of which are missing since they're CE-specific. Dependency Walker doesn't run on the CE device (unless there's a CE version I've missed?). I tried to copy the DLLs from the CE device to a flash drive so I could load them into DW on my development machine, but the device won't allow me to do so. The OEM tool I have for transferring files unfortunately only transfers to the device. [Edit: I haven't tried writing my own tool to try to pull files from the device to development machine.]
Some details on how I've set up the project, in case I have some wrong assumptions on that end. I have tried with two projects. One has my code in it (the ActiveX Control itself is just a graphical representation of some data, which I had originally set up in a win32 ActiveX control to see how it looks), and one is a clean project - created from template, compiled, downloaded to device; no code added or configuration changed. Both have the same result when trying to register.
Using VS2005, created a project using the "MFC Smart Device ActiveX Control" template, targeting the SDK I received from the OEM.
In the case of the project with my code in it, I copied my drawing code into the project and created the necessary properties for the data input. I can provide more details on my code if it would help, but my issue happens even without the code. I am assuming that since it compiles successfully when targeting the SDK from the OEM that the functions I am using are supposed to be available on the target device.
Build the project in Release configuration (I wondered if the debug libraries were missing on the target device and causing the issue).
Transfer the .ocx file to the target device using an OEM tool.
Start command line on target device, move to directory the .ocx is in, run "regsvrce.exe .ocx". I have also tried transferring all of the files that VS leaves in the build output folder, but the result is the same.
Many thanks in advance for any answers! If you see something obvious point it out - this is my first ActiveX project and my first CE project, so it's very possible I'm missing something basic.
Since you build OCX I assume that you are using MFC. How do you link with MFC? Look in project settings|General, try to select "Use MFC in a Static Library". Same goes for ATL - try selecting "Static Link to ATL" (if you use ATL). This goes also for VCRT - in C/C++|Code Generation, in "Runtime Library" try selecting options without the 'DLL' (i.e. - statically link with VCRT).
Since the default empty OCX does not work for you - this is the only thing I can think of...
Another thing - I assume you have a reason for working with Visaul Studio 2005? Why not a newer version?
Good luck, PazO

Resources