Hi there,
I'm trying to build a standalone executable (and NOT having an installer program is an hard requirement) which has to download files over HTTPS.
I noticed that the sockets library relies on OpenSSL to open the SSL tunnel. The corresponding Nimrod wrapper seems to reference the DLL by name and, indeed, the generated C source code contains a call to nimLoadLibrary (which I assume is a wrapper to dlopen()/LoadLibrary() -- didn't look into that in details but Nimrod's C FFI seems to work in a manner similar to Python's ctypes).
Is there a (simple) way to force the compiler to not load the library and just assume the symbols will be there when, at link time, I bring them in from the OpenSSL static library?
I guess that since Nimrod, in the end, generates C source code and calls a C compiler this should be theoretically possible but I'm not sure how/if it is feasible as of yet.
Hi,
I managed to prevent the compiler from generating calls to nimLoadLibrary, however no matter how I try, while I seem to be able to tell the compiler/linker to look up symbols in libeay32.a and ssleay32.a but I can't get it to actually bundle the static library inside the exe. That is, the resulting executable is always the same size even though I expect it to bump up in size considering that libeay32.a is > 2 Mb big. Also if I peek into the final executable with Dependency Walker I always see references to LIBEAY32.DLL and SSLEAY32.DLL which is weird since nowhere on gcc or ld command line I tell it to dynamically link to those library. Heck, I even tried stripping the dynlib pragma everywhere from openssl.nim.
To summarise:
At this point I tried a couple of alternatives to statically link OpenSSL:
At this point I also tried passing --passC=--verbose --passL=--verbose --passL=-Wl,--verbose to inspect command line arguments passed to MinGW's gcc.exe and ld.exe but as far as I know, it's picking stuff from where I'm expecting it to.
It's been about 10 years since I last used Windows for more than playing casual games so I might be missing something obvious here :)
For those curious: the project is hosted on GitHub and available here: https://github.com/lvillani/just-install/tree/nimrod