[Wine] Re: Problems creating a winelib-based program

Segin segin2005 at gmail.com
Mon Mar 19 00:45:50 CDT 2007


Fleabag wrote:
> Hi Daniel
> 
> Firstly, thanks for your response... answers below.
> 
> Daniel Skorka wrote:
>> Fleabag <madparrott at gmail.com> wrote:
>>> As a proof of concept, I have started small. I wrote a simple Windows
>>> DLL with an exported function which returns a string, and built it on
>>> my Windows PC. I wrote a OS X program (source code is in
>>> "simpleapp.cpp") which loads the DLL (using LoadLibrary), locates the
>>> function (using GetProcAddress), calls the function and displays the
>>> string to stdout.
>> I do not quite understand. If this program uses the Win32 API and will
>> be compiled using winelib, why do you call it an "OS X program"?
> 
> It really has to be an OS X program. Think of it as something written
> 99% for the Mac, using pure Mac system calls etc, but one tiny corner
> of the program actually calls into a Windows DLL to gain some
> functionality, and tries to use winelib to get that access.
> 
> As an analogy, its a bit like fitting a Sony CD player into a Ford car
> to replace the old cassette radio in the Ford, the Sony gives you a
> better sound than the old Ford one would have done, but you don't have
> to buy an entire Sony car to fit a Sony stereo...
> 
> I hope that makes things clearer...
> 
> 
>>> I used winemaker to generate the Makefile, then built it using make.
>>> This automatically linked the executable with winelib. The result is a
>>> file called "simpleapp.exe.so". It does execute and function as
>>> expected, BUT, unfortunately cannot be run standalone, it seems it
>>> *has* to be launched using "wine simpleapp.exe.so". If I try to run
>>> simply "./simpleapp.exe.so" then I get the message "Bad program (or
>>> shared library)".
>> As I see it, you want a library and not a standalone executable. What
>> happens if you tell your application to use simpleapp.exe.so as a
>> plugin?
> 
> 
> I hadn't got that far, that seemed more complex than trying it as a
> single Mac-built exe and a single Windows-built DLL. Yes you're right
> that is what I ultimately want, but I was trying to start simple :-). I
> have actually written a further application ready to call
> simmpleapp.exe.so as a plugin, but haven't succeeded in building it
> yet, I get some unresolved library calls.
> 
> Cheers, Fleabag.
> 

The reason that Winelib files are .exe.so is because they must be 
compiled as shared libraries. This is because the only possible way to 
do a executable you can directly load is to create a entry point 
function for every OS running wine. Sure, you could possibly do a main() 
function, but it would have to startup Wine and bootstrap from there. 
Wine's architecture wouldn't allow the program to run anyways because it 
couldn't initialize Wine properly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://www.winehq.org/pipermail/wine-users/attachments/20070319/9c7bb143/signature.pgp


More information about the wine-users mailing list