Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using windows DLLs in a portable app

I have built a windows C++ application that I'd like to port to linux. The main reasons to do this is ease of system maintenance for our IT staff. Apart from the one windows machine that runs this application we're a linux only operation.

The reason this application was built in-, and runs on- windows is that it uses a windows API (dll and header) to connect to a server belonging to an external party. This connection uses some proprietary protocol that I don't really want to mess with, (and I think I'm contractually not allowed to) so I'm stuck with the .dll.

This dll is windows only because of (I suspect) windows sockets specific code in the dll. Apart from that it doesn't do a whole lot of advanced stuff. Is there a way somewhere between just running the app on linux in WINE and sniffing out the protocol and reimplementing the DLL myself that will allow me to get this application to run on a linux machine?

This idea got inspired by this item about QT creator so any solution that allows me to play with that would be extra cool.

like image 845
jilles de wit Avatar asked Nov 09 '08 22:11

jilles de wit


People also ask

Are DLL portable?

Both EXE and DLLs are based on the Portable Executable (PE) file format.

What app can open a DLL file?

The Microsoft Windows Visual Studio is a program that allows you to view, edit and build code into a DLL file. When you import code into Visual Studio, it may automatically convert the code into the programming language C# even if it was in a different programming language before. Download Microsoft Visual Studio.

What is DLL in mobile application?

A dynamic link library (DLL) is a shared program module with ordered code, methods, functions, enums and structures that may be dynamically called by an executing program during run time. A DLL usually has a file extension ending in .


1 Answers

The most obvious middle ground would be to use Winelib. I do not know if it can link directly to a native DLL, but if not you probably could load it with LoadLibrary().

You could then split your application in two parts: a wrapper which only calls the DLL, and the rest of the code talking to your wrapper. You could have both in separate processes, and thus only the wrapper would have to be compiled with Winelib. The rest of the application could then use whatever framework you want.

like image 190
CesarB Avatar answered Oct 03 '22 22:10

CesarB