<div>The issue of the order of global&nbsp; C++ object&#39;s constrution has been metioned </div>
<div>in wine development guid section <a name="AEN2932">8.3.3.Starting a Winelib process</a></div>
<div>&nbsp;</div>
<div>For the first scheme, </div>
<div>how can we made win_init as the entry of .init section.</div>
<div>Implement like .strat() in preloader.c ????</div>
<div>&nbsp;</div>
<div><br>&nbsp;</div>
<div><span class="gmail_quote">2007/8/22, trulyliu &lt;<a href="mailto:trulyliu@gmail.com">trulyliu@gmail.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div dir="ltr">
<div dir="ltr">Hi, Damjan Jovanovic</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">Thank you tired of the answer to my questions.</div>
<div dir="ltr">&nbsp;</div></div>
<div dir="ltr">I carefully read the wine part of the code and development document, searched in mail lists, these days.</div>
<div dir="ltr">And I got some inspiration from wine plugin API wiki page and wine loader&#39;s code.</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">I am considering of an approach.</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">Link preloader and related resource(libwine) with my Linux native App.</div>
<div dir="ltr">Do some modify with wine_init function, and call it before main(). </div>
<div dir="ltr">This can be implemented by a global C++ objects&#39;s constructor.</div>
<div dir="ltr">Upper two steps can deal with TEP and FS register.</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">But I there&nbsp;may be&nbsp;another problem.</div>
<div dir="ltr">If&nbsp;there was aready an static global C++ object in my App, </div>
<div dir="ltr">How can I makde it initiatited after wine_init from in object.</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">Do you have some other expostulate of this idea?</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">BTW, I skim over&nbsp;mplayer and xine&#39;s parts of code.</div>
<div dir="ltr">They don&#39;t dealwith TEB and FS register.</div>
<div dir="ltr">They only do sth on LDT and allocat PE header before LoadeLibaray.</div>
<div dir="ltr">Why&nbsp;they can run correctly???</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr">&nbsp;</div>
<div><span class="gmail_quote">2007/8/22, Damjan Jovanovic &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a>&gt;:</span> 
<div><span class="e" id="q_1148ca4814596753_1">
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On 8/21/07, trulyliu &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">
trulyliu@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt;<br>&gt; 2007/8/21, Damjan Jovanovic &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com
</a>&gt;:<br>&gt; &gt; On 8/21/07, trulyliu &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">trulyliu@gmail.com</a>&gt; wrote: <br>&gt; &gt; &gt;<br>&gt; &gt; &gt;
<br>&gt; &gt; &gt; 2007/8/21, Damjan Jovanovic &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a>&gt;:<br>&gt; &gt; &gt; &gt; On 8/21/07, trulyliu &lt;
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank"> trulyliu@gmail.com</a>&gt; wrote:<br>&gt; &gt; &gt; &gt; &gt; Can I made <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://arithmetic.dll.so/" target="_blank">
Arithmetic.dll.so</a> ? And link it against my linux App?<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; A library function runs in the context of the process that invokes it. <br>&gt; &gt; &gt; &gt; A library doesn&#39;t have its own TEB/memory layout/exception handling
<br>&gt; &gt; &gt; &gt; that works independently of the process that calls it, no matter how<br>&gt; &gt; &gt; &gt; it is compiled. If the wine plugin API is ever made, it will modify <br>&gt; &gt; &gt; &gt; the process so it has what the library expects when the library
<br>&gt; &gt; &gt; &gt; functions are called.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Does your <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://arithmetic.dll.so/" target="_blank">Arithmetic.dll.so
</a> call any Windows functions? If so, you<br>&gt; &gt; &gt; &gt; need wine and you will always need wine, plugin API or no plugin API,<br>&gt; &gt; &gt; &gt; whether you compile it into a DLL or .dll.so. But if you only use ANCI 
<br>&gt; &gt; &gt; &gt; C stuff you can compile it into a .so and use it without wine.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; If you want something that runs seamlessly on every operating system<br>&gt; &gt; &gt; &gt; today, IMHO you should consider Java. 
<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Yes, Java may be a good choice for crossing platform.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; As you said, my Arithmetic.dll
 does not call any windows function.<br>&gt; &gt; &gt; It&#39;s pure ANSI C library. What&#39;s the step of make .dll.so ??<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Use winegcc or gcc ??<br>&gt; &gt;<br>&gt; &gt; Use gcc and make a .so like this: 
<br>&gt; &gt; gcc -c arithmetic.c -fPIC<br>&gt; &gt; gcc arithmetic.o -shared -o arithmetic.so<br>&gt; &gt;<br>&gt; &gt; Then put it in /usr/lib and link to it like so:<br>&gt; &gt; gcc -c application.c<br>&gt; &gt; gcc application.o
 -o application -larithmetic<br>&gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; --<br>&gt; &gt; &gt; &gt; &gt; <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">trulyliu@gmail.com
</a><br>&gt; &gt; &gt; &gt; Damjan<br>&gt; &gt; &gt; --<br>&gt; &gt; &gt; <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">trulyliu@gmail.com</a><br>&gt; &gt; &gt;
<br>&gt; &gt;<br>&gt; &gt; Damjan<br>&gt;<br>&gt; gcc -c arithmetic.c -fPIC&nbsp;&nbsp;???<br>&gt; I am sorry. I don&#39;t have Arithmetic.dll&#39;s source code. <br>&gt; Can I use LoadLibaray() and GetProcAddress<br>&gt; to get the function which 
Arithmetic.dll exports.<br><br>No, for the reasons I talked about before. Eg. GetProcAddress() does<br>look&nbsp;&nbsp;up the current directory, which resides in the TEB, which AFAIK <br>resides in the FS CPU register on Windows. On Linux the FS register
<br>contains something else, leading to a crash.<br><br>At the moment, you can only use Windows DLLs from Windows applications<br>or from winelibs, which are Windows applications compiled to be able <br>to use Linux libraries as well.
<br><br>&gt; --<br>&gt; <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">trulyliu@gmail.com</a><br>&gt;<br><br>Damjan<br></blockquote></span></div></div><span class="sg">
<br><br clear="all"><br>-- <br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:trulyliu@gmail.com" target="_blank">trulyliu@gmail.com</a><br></span></blockquote></div><br><br clear="all"><br>-- <br>
<a href="mailto:trulyliu@gmail.com">trulyliu@gmail.com</a><br>