Live data from Hacker News

Porting Windows Dynamic Link Libraries to Linux

github.com

11–20 of 44 posts

Re: Porting Windows Dynamic Link Libraries to Linux

#11
post #7

Why not just use full-on WINE? The basic system calls are pretty much fully covered. It seems this duplicates a lot of work.

Are the Windows API implementations of WINE usable by a native Linux program (eg as a library of some sort)? That seems to be the requirement here.

Yes - using WINE as a library is one way of porting to Linux.

Re: Porting Windows Dynamic Link Libraries to Linux

#13

Earlier quoted context omitted.

...why not?

I've always thought why is more important than why not. Example: "I'm going to hit myself in the dick with a hammer."

Your example has an obvious great answer to "why not?", though, so no harm done in asking that question first.

Re: Porting Windows Dynamic Link Libraries to Linux

#14
Did this close to twenty years ago. Ported a COM DLL to Linux and one of the executables using it.

I implemented everything it needed. COM functions like CoCreateInstance, entry points like DllCanUnloadNow, Windows Sockets and whatnot.

The registry API! Ha. I mapped HKEY_CURRENT_USER to configuration files rooted in the user's home directory, and HKEY_LOCAL_MACHINE to /etc.

The lib's DllRegisterServer nicely registered its COM class inside the fake registry.

Don "COM is Love" Box would have teared up had he seen this.

Re: Porting Windows Dynamic Link Libraries to Linux

#15
post #7

Why not just use full-on WINE? The basic system calls are pretty much fully covered. It seems this duplicates a lot of work.

Are the Windows API implementations of WINE usable by a native Linux program (eg as a library of some sort)? That seems to be the requirement here.

Yes, I've written a windows dll loader for linux based on wine myself. It's fairly simple to add support for LoadLibrary() and GetProcAddress() to a linux program using wine libraries.

Re: Porting Windows Dynamic Link Libraries to Linux

#16

Did this close to twenty years ago. Ported a COM DLL to Linux and one of the executables using it. I implemented everything it needed. COM functions like CoCreateInstance, entry points like DllCanUnloadNow, Windows Sockets and whatnot. The registry API! Ha. I mapped HKEY_CURRENT_USER to configuration files rooted in the user's home directory, and HKEY_LOCAL_MACHINE to /etc. The lib's DllRegisterServer nicely register…

[deleted]

Re: Porting Windows Dynamic Link Libraries to Linux

#17

Earlier quoted context omitted.

...why not?

I've always thought why is more important than why not. Example: "I'm going to hit myself in the dick with a hammer."

Well, why don't you MARRY safe science if you love it so much!! :)

Re: Porting Windows Dynamic Link Libraries to Linux

#18

Did this close to twenty years ago. Ported a COM DLL to Linux and one of the executables using it. I implemented everything it needed. COM functions like CoCreateInstance, entry points like DllCanUnloadNow, Windows Sockets and whatnot. The registry API! Ha. I mapped HKEY_CURRENT_USER to configuration files rooted in the user's home directory, and HKEY_LOCAL_MACHINE to /etc. The lib's DllRegisterServer nicely register…

Open Group had COMsource: http://www.opengroup.org/comsource/

Re: Porting Windows Dynamic Link Libraries to Linux

#19
This is cool and a lot lighter than WINE, though the important keyword is self-contained Windows libraries. I gather this won't work on DLLs that call any of the plethora of Windows APIs. I'm actually very surprised that any non-trivial DLLs are self-contained in this way, like his example of Windows Defender which I thought would call 1000 Windows API functions.

Re: Porting Windows Dynamic Link Libraries to Linux

#20
post #19

This is cool and a lot lighter than WINE, though the important keyword is self-contained Windows libraries. I gather this won't work on DLLs that call any of the plethora of Windows APIs. I'm actually very surprised that any non-trivial DLLs are self-contained in this way, like his example of Windows Defender which I thought would call 1000 Windows API functions.

I would imagine anti virus products are more self contained so that they don't rely on potentially compromised code.
Post reply on HN