<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> 
<div>
<div>Thanks, but no, it doesn't come any smaller - the 100 API calls is the internal API.</div>

<div>Poking through the wine code, I've come to the same conclusion in the meantime.</div>

<div>Not modular and not reusable.</div>

<div>I'm still a bit alienated, as I think others have to have had the same problem before.</div>

<div>But I guess it's just not a planned/intended use case. </div>

<div>Well then wine/winelib as such is useless for me.</div>

<div> </div>

<div>Wine has non-the-less been useful, as I can look at the source of the functions, and determine what they actually do. </div>

<div>Have managed to replace 2 COM-calls already.</div>

<div>I'm just going to have to use a C#-Freetype-wrapper to copycat the textmetrics struct initialzation and all the code around in C#.</div>

<div>usp10# with a little gdi32# so to say.</div>

<div> </div>

<div> </div>

<div> </div>

<div> </div>

<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 04. September 2018 um 03:13 Uhr<br/>
<b>Von:</b> "Stefan Dösinger" <stefandoesinger@gmail.com><br/>
<b>An:</b> "Wilma Feuerstein" <officedev@gmx.ch><br/>
<b>Cc:</b> wine-devel@winehq.org<br/>
<b>Betreff:</b> Re: Possible to call winlib function from native program ?</div>

<div name="quoted-content">
<div> 
<div> 
<blockquote>
<div>Am 30.08.2018 um 23:56 schrieb Wilma Feuerstein <<a href="mailto:officedev@gmx.ch" onclick="parent.window.location.href='officedev@gmx.ch'; return false;" target="_blank">officedev@gmx.ch</a>>:</div>

<div>
<div>
<div style="font-family: Verdana;font-size: 12.0px;"> 
<div>I'll have to think about whether it might be easer ripping the respective code out of wine. </div>
</div>
</div>
</div>
</blockquote>
You can try, but my guess is that you'll run into calls to lower-level Wine functions that will cause you the same pain as dlopen does.</div>

<div> </div>

<div>
<blockquote>
<div>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>Writing a socket server for ~100 APIs with byref-arguments, with C and Windows-size datatypes on one side, and C# on Linux on the other, where the C# code runs inside a web-server, seems like a daunting task that might be more complex than writing a basic web server.  </div>
</div>
</div>
</div>
</div>
</blockquote>
You don't necessarily have to marshall the Win32 API. Do you have any internal APIs in your software (e.g. between your host process and a plugin) that is smaller?

<blockquote>
<div>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>
<pre>Is it not somehow possible to load the wine-server process inside the libtest.dll.so-constructor ? 
#define LINUX_ATTACH_DLL __attribute__((constructor)) 
whether that server process would be started inside the same process or outside wouldn't matter much. </pre>
</div>
</div>
</div>
</div>
</div>
</blockquote>
I don't know for sure. You could read through Wine's init code in loader/main.c, libwine and ntdll and see if you can reconstruct it elsewhere. It is certainly not a simple task.</div>

<div> 
<blockquote>
<div>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div> </div>

<div>If I had to manually dlopen the dependencies between crypt32.dll, user32.dll, advapi32.dll and bcrypt.dll - and whatever - in the right order, that's something I could live with. </div>
</div>
</div>
</div>
</div>
</blockquote>
The problem isn't just loading the libraries, you also have to resolve the imports. You might be able to dlopen ntdll.dll and then use LdrLoadDll to load the higher level DLLs.</div>

<div> </div>

<div>But just looking at the first lines of LdrLoadDll brings up a call to NtCurrentTeb(), which will return NULL unless you also call the right ntdll init code.</div>

<div> </div>
</div>
</div>
</div>
</div>
</div></div></body></html>