Winlib, winebuild and linux shared libraries questions

whitnl73 at juno.com whitnl73 at juno.com
Wed Feb 12 21:28:20 CST 2003


On Thu, 13 Feb 2003, Paulo de Carvalho wrote:

>
>
> whitnl73 at juno.com wrote:
>
>
> > What is it you are trying to do?
>  > This is getting too abstract for me.
>
> Ok, you're right. I'm sorry.

My fault.  I lost track of where I was.
>
> What I really want is to use some proprietary 3rd party windows dlls in
> JAVA through JNI (Java Native Interface) and I want to do it using
> Linux. ( Gosh! How this sounds absurd! )

I don't think so.
>
> But suppose you would want to use those 3rd party libraries in Perl, or
> Python, or PHP, or something like that, on Linux, I believe you would
> also need some kind of extension mechanism based on libraries. If so,
> link-against-wine-libs-and-lauch-with-wine method wouldn't work, I guess.
>
> I already made some sample applications that use those 3rd party dlls,
> ported them using winelib and they run fine under wine :))
> But, as you've said, these applications have to be linked with wine libs
> and they need a wine command to be launched.
>
> Well, working with JNI, involves creating a library. Using a library, I
> can't use the wine command to setup the windows environment these dlls
> expect so I must do this in some other way.

Why not?  What is wrong with system(), - as long as not in a suid
executable - or fork() and execve()?  A winelib program has the *NIX
environment, fd's and library API available to it.
>
> You already said I can't use the library <appname.so> winemaker creates
> because it's an "Unix library in format not in content" so, this won't do.

Well, sort of.  Any reference not imported from a winelib dll (remember
you can create your own winelib dll's too (and/or contribute them back
to wine, if they have some wide relevance)) is resolved against the *NIX
libraries, so in that respect a winelib app or dll is a *NIX program or
library in content as well.  Winemaker (or winebuild (not sure which)
sets up an _init to do windows initialization and call either main or
WinMain...  winebuild has an option -i to force a reference to be linked
against the unix libraries instead of imported from a winelib dll.
>
> That's why I was thinking in taking the wine code needed to setup the
> virtual windows environment and put it in the _init proc on a shared
> library...

I don't think you need to.  See if you can make sense of what I've
written above.
>
>   "If a function ``_init'' is exported in a library, then it is called
> when the library is first opened (via dlopen() or simply as a shared
> library)." - Program-Library-HOWTO
>
> but many questions arise...
>
> - Can _init proc be used to do something like this ?
> - Which pieces of wine code should I put in the _init proc ?
> - Is the _init proc behavior is compatible with wine way of doing things?
> - How JNI will react to something like this ?
>
If you turn out to need answers to these, we may need to move this to
wine-devel

> > As it said in the snippet you quoted to start this, a wine dll is a
> > win32 dll encapsulated inside a Unix library.
>
> ... only to be used with wine!
>
> IMO this sentence should be changed, since it can be misinterpreted
> (well, at least I did). It should be added what you've said: a Unix
> library in format not in content.
>
Oh, come on!  I can misinterpret anything.  When we get it sorted out,
you or I can offer a patch to improve the doco, I guess.

>
> Thank you!
> Paulo
>
>
Lawson
--
---oops---



________________________________________________________________
Sign Up for Juno Platinum Internet Access Today
Only $9.95 per month!
Visit www.juno.com



More information about the wine-users mailing list