I'm trying to use a open source library from a Windows application, and the only pre-built version I can find comes as a file called "lib.dll.a"
What format is this, and can I convert it to a normal dll file?
Naming the output file libjvm.dll.a will allow gcc to recognize it as a
library named jvm. The .dll.a suffix indicates (by convention) that it is
an import library, rather than a static library (which would simply be named
libjvm.a, again by convention).
Related
I've dynamically linked libhunspell.dll (HunSpell) to my application. It works, but there is a dumb problem which I don't know why it happens.
Even before I use LoadLibrary("path\\to\\libhunspell.dll"); to load it and use it, on the start of the application it attempts to load the library by itself. If I place the libhunspell.dll into the path where my main executable resides, it can load it, otherwise it reports an error, immediately after starting the application - This application has failed to start because LIBHUNSPELL.DLL was not found. Re-installing the application may fix this problem. and the application doesn't start.
I would understand if the LoadLibrary would use invalid path but this happens as soon as the executable runs, even before the first statement in WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) executes (I've tried to place a breakpoint and it doesn't even reach it, so this happens before).
So, as a result, I must place libhunspell.dll in the same folder as my application executable, and not in the path I want.
This is probably easy to fix although I don't what to look for.
So the question is - how do I avoid it loading it immediately and have it wait until I use LoadLibrary call?
Here is how I linked if it can help:
1) compiled libhunspell.dll in Visual Studio 2015 (I used /MT option to link it statically so it doesn't have VC++ Redistributable as a dependency).
2) created import library (libhunspell.lib) using implib.exe -a -c -f libhunspell.lib libhunspell.dll
3) linked that to the source .cpp unit which is using it using #pragma comment(lib, "libhunspell.lib") (it is RAD Studio 2010 so the .lib is required unlike newer versions).
4) later in the same .cpp used LoadLibrary to load this library and used it.
By linking in the import stubs (libhunspell.lib) the OS will load the DLL for you as it is now a static dependency.
One approach would be specify the library as a delayload dependency: /DELAYLOAD:libhunspell.lib via the linker options. You can then call LoadLibrary on the DLL.
The only other option is to stop including the .lib in the linker step, making it truly a dynamic dependency.
I assume you did Add to project a *.lib file for your DLL. That is a kind of "static" linkage done in the App initialization (prior to your forms are created). So it has two disadvantages.
You DLL must be in the same path as the Apps EXE file
Sometimes DLL file name is locked (can not be changed)
The advantage is that you do not need to do any coding for the DLL loading as the VCL do it for you ... so your app should not contain the LoadLibrary,GetProcAddress calls you just include the *.h file with propper import declarations ...
For dynamic linkage you need to remove the *.lib from your project and use WinAPI LoadLibrary + GetProcAddress for loading your DLL as josh poley suggested. Here an example:
Builder C++ calling VC++ class
Beware there was/(is?) a bug in the GetProcAddress preventing from loading all the functions from your DLL in some cases. Especially if the DLL has old legacy mangling of names the count of functions is high and the DLL was created on compiler incompatible with the mangling in question.
I've tried to convert a tcl file to a exe file by using FREEWRAP.EXE .
It works on most of the files, but there is one file which includes a line of code "load TLTcl.dll " which will always fail.
When I run the tcl file with activetcl, it was fine.
Since I convert the tcl file to a exe file and put TLTcl.dll on the same folder with it, the exe always crash while executing.
I wonder how to load a dll file in the tcl file when I turn a tcl to a exe.
Thanks a lot !
puts "Starting FLASH script"
puts "FLASH write will be performed now, make sure you have an extra flash... "
#load 10 lira tcl DLL
load TLTcl.dll
It sounds like TLTcl.dll was not built with stubs support, which means that it links against a real tcl.dll (possibly with a version number in the name) and freewrap doesn't use that; it uses a statically-linked build so that the whole system can be a simply-redistributable file.
You'll need to rebuild TLTcl.dll with stubs support enabled (assuming it is a DLL that implements a Tcl extension). That's not usually too difficult, as it is a matter of defining the USE_TCL_STUBS preprocessor symbol when compiling all the files, and linking against the tclstub static library; it probably has the version number embedded in the filename (and the version of the Tcl headers you compile with and the stub library you link with must match). Note that it is a property of Tcl's API that if you build against the Tcl 8.5 stubbed API, you can be loaded into a Tcl 8.6 interpreter. (Indeed, that level of forward compatibility is there from about 8.0.6† through to 8.7, which is still in active development so you won't be using it yet.)
†This was a version that was only released to a few commercial partners. Everyone else used newer supported versions.
I want to use the ctfconvert and ctfmerge in CMake. I went through couple of links below.
https://java.net/projects/solaris/sources/on-src/content/usr/src/tools/scripts/nightly.sh
http://lethargy.org/~jesus/writes/mdb-ctf-dwarf-and-other-angelic-things/#.V-JUFPl97X4
The source in links states that we need to create object file of the source and then apply ctfmerge and ctfconvert over that. I came to know that there is a facility to create OBJECT library in CMake. But I am not getting how to apply these ctfconvert and ctfmerge on OBJECT libraries as $<"TARGET_OBJECTS:objlib> can only be used in add_library() or add_executable().
How to solve this issue?
We need to install onbld package on Solaris 11 or need to build Solaris 10 source code to get onbld package to install ctf binaries.
Then ultimately need to call ctf binaries in CMakeList.txt to run. We need to create a object file from ctfconvert binary and then need to use ctfmerge when we create an executable/shared library to merge the obhect file containing ctf header information to newly created executable/shared library.
If we need to create static library, we just need to use ctfconvert over the file to create the object file containing ctf header which will put those files in archive. When we use this static library in creation of executable/shared library, at that time, we need to use ctfmerge over each object file from static library.
I know that LIB files are static link - when I use it in my project, on compiling, all it's content added to my file. DLL is dynamic - loaded to memory and all the projects that needs it, can use it.
Why should I use DLL instead of LIB (and vice versa?
How can I compile my code to DLL (or LIB)?
Thank you
According to this wiki page, .lib files are used in conjunction with .dll, which means that you don't have to prefer one over another.
For example, kernel32.dll, the primary dynamic library for Windows'
base functions such as file creation and memory management, is linked
via kernel32.lib.
I download a autotrace library to use in my java project but it contains only (libautotrace.a, libautotrace.la, libautotrace.dll.a and header)
my question: is it possible to convert libautotrace.dll.a to dll library?
You can not.
The dot-a files you have were compiled for a Unix system, and can not be directly converted to a Windows format.
You will need to find a windows-native build or the source code to build it yourself.