On 09/09/2020 15:25, spaarder wrote:
Hello,
I want to contribute to the wonderful Wine project, so I decided to start with a simple patch for the CreateSymbolicLinkW WINAP in kernelbase.dll .
In my patch I use the system() function, which is in the stdlib library. The linker cannot find this library because of the "-nodefautlibs" in Makefile.in . When I remove -nodefaultlibs, all compiles well, but now wineboot (and probably a _lot_ of other things) are broken, even if I undo my patch.
Why does removing -nodefaultlibs from wine/dlls/kernelbase/Makefile.in break so many things? Has it anything to do with @ cdecl system(str) MSVCRT_system?
What would be the "proper" (wine) way to solve this?
Big thanks!
Hans.
Hi Hans,
Unfortunately, CreateSymbolicLinkW is actually complicated. There are patches in wine-staging that implement it, so you can take a look there and see why that is so (because Windows also has junction points and so on). See the ntdll-Junction_Points patchset in wine-staging.
Now for your question about -nodefaultlibs: the wine dlls that have this flag are compiled as native Windows .DLL PE files. That means they can't use system (unix) functions. kernelbase is one such example: most of the functions in kernelbase are done through ntdll.
ntdll is also compiled as PE, but it has a unix library component (to be able to use unix libraries or communicate with the wine server). So in general, the procedure would be to:
Implement symbolic links via some ntdll API. Have kernelbase use the ntdll API to implement it.
You can see a 'unix' subdir in the ntdll, which is where the unix library is, and it's called through function pointers from the PE module (all files at the root of the dir).
Again, the wine-staging patchset might help you in with clues. I'm not that familiar with the details myself, so I apologize if I said something wrong.
Someone more knowledgeable might clarify it better, if they have the time.