I have windows dynamic linked library which I want to access from Linux environment. I don't have the source code of that library, so I cannot build .so file.
Is there a way by using Winelib or any other library or tool for converting library file to .so file, so that I can call functions defined in that library?
There is no easy way to do it, because the DLL cannot run in Linux enviromnemt all by itself. It will probably rely on user32.dll msvcrt.dll and friends at runtime, so you'll have to provide those files as well.
You can use winelib, but it doesn't just convert a .dll to an .so. You'll have to link the whole project that wants to call the DLL against winelib, and include the DLL itself with your app at runtime. If you are trying to port a Windows app to Linux, winelib will be able to convert your makefile for you, but it's far from automatic for complex projects.
Related
I am developing a C++ program which is using 6 different libraries (like Boost, OpenCV, Protobuf etc). I've compiled and installed all required libraries on my development PC. I want to export the program to work in another computer standalone. I can copy all the shared libraries to a folder and put the executable next to it but it will be really useful as my program's size would be enormous. Is it possible that MSVC++ exports all the shared libraries (and maybe the include files too) which are used in compilation?
Edit: Let me make clear the question.
I've libraries & header files all around in my PC (Like C:\boost\lib, D:\Workspace\opencv\lib etc..)
I don't use most of the libraries in these folders in my application.
I want to run my application at another computer.
I don't want to install all the libraries to the new computer.
I want only that MSVC export the required(used) shared libraries to another folder that I specify so I can copy only 1 folder containing only required libraries in it.
Is it possible?
Here's my dilemma: I'm attempting to create a .dll version of my project. This project uses the V8 and CURL libraries which are currently built as debug .libs. I'd like to package all of them up in a single DLL that can be shared (I understand I need to alter my code with __declspec(dllexport) but that's a separate issue) to others.
Do I need to compile the V8 and CURL libraries as DLLs then somehow wrap them up in my own DLL?
If you have a .lib with no .dll for the CURL libraries, then they are most certainly static libraries. When you link them to your DLL, the code from these libraries is linked into your DLL.
I've generally had to include the source for the dependencies (in your case both V8 and CURL) in my project and build that way to get them completely incorporated without extra headaches.
If you have libs and you link to those you SHOULD get them merged though.
.Net class can be compiled into a shared library (.dll). Can a mono class be compiled into a shared library in linux (.so)? how?
.Net .dll files are not real, i.e. native, shared libraries. By default, Mono also produces and consumes .dll files, using the same assembly format as Microsoft .Net. Both runtimes generate native code from this intermediate format during runtime.
However, it is possible to perform Ahead-Of-Time (AOT) compilation and save the resulting .so file to disk (Microsoft .Net equivalent of this is the ngen.exe native image generation and cache). When you invoke Mono with the --aot flag, it will save the native code in form of a .so library and use it whenever the same file is loaded again. You probably also want to add the -O=all flag to enable all optimizations (some of them are disabled by default because they are costly to perform).
However, please bear in mind that the cached native library probably won't be usable for linking into native programs.
I have an legacy application which builds into exe.
I am using Visual Studio 6.0 and the application is an c++ application. It used many lib files, built in VS6.0. Now i need to use the api's which in the executable. I want to create a lib file while it is creating an exe. I cannot change the code of the legacy application.
Any help is highly appreciated.
Thanks,
AH
Create a separate library project and add any source files with APIs you want to reuse into it. It's probably cleaner to also remove those files from the exe project and make the exe project depend on the library project, but this isn't strictly necessary.
This question already has answers here:
Using Windows DLL from Linux
(7 answers)
Closed 2 years ago.
Question: Is it possible to compile a program on linux using a .dll file?
Where this is going:
This .dll will be used to write a php extension to some proprietary software from a third party.
Background and Research:
I have been given a library called proprietary.lib. I was curious, as I have never seen the .lib extension before, so I typed:
file proprietary.lib
The output was:
proprietary.lib: current ar archive
I did some research and found that ar is more-or-less tar (and in fact, I guess tar has since replaced ar in most *nix environments).
Upon inspecting the ar manpage, I saw the t option, which displays a table listing of the contents of that archive. Cool. So I type:
ar t proprietary.lib
And get:
proprietary.dll
proprietary.dll
... (snip X lines) ...
Recent development may have changed the situation: There is a loadlibrary function for Linux available, that makes it possible to load a Windows DLL and then call functions within.
So, if the .dll file you have actually is a Windows DLL, you may find a way to use it in you software.
You could try extracting the ar file (Debian packages are ar files, fwiw) and run file on the contents.
You're not going to be able to use Windows DLLs without translation. The only DLL files that I know of that work natively on Linux are compiled with Mono.
If someone gave you a proprietary binary library to code against, you should verify it's compiled for the target architecture (nothing like trying to use am ARM binary on an x86 system) and that it's compiled for Linux.
That being said...good luck. I hate programming against third-party libraries where I have the documentation and the source.
.dll files are usually Windows shared libraries. (It's also possible that somebody on Linux has built a regular Linux library and called it .dll for some reason.)
It's possible you could link against them using Wine. Support for this was once in there as experimental - I don't know its current status.
Yes We can use dll with the help of wine .
just install wine64 in linux
sudo apt-get install wine64
Normal DLL files are Windows' linked libraries, so they cannot run on Linux directly, however it's possible to compile DLL files specifically for Linux using .NET Core.