On Fri, 15 Sep 2000 [EMAIL PROTECTED] wrote:

> Quoting Eric Pouech <[EMAIL PROTECTED]>:
> > what are you actually trying to achieve ?
> > 1/ port an existing DLL (or reuse its code) under Wine ?
> > 2/ write a winelib app that uses an existing DLL ? (from the binary
.dll
> > file ?)
> >
> > your request ain't clear. it seems to me that you want to achieve 2,
> > whereas
> > you're using techniques for 1/.
>
> I'm trying to achieve [2].  I have the Quicktime SDK for Windows from
> Apple,
> which includes the binary qtmlclient.dll and the headers for all the
> functions
> it contains.  I want to write an application under Linux that is able
to
> load up
> this binary .dll and call assorted functions contained therein.  I'm
able
> to
> compile my code (which is their win32 sample code for using the .dll
for
> now),
> but I'm confused about how to do the linking such that my calls go to
the
> .dll.
> It's my impression that I'm supposed to write a .so that serves the
same
> purpose
> an import .lib file does under Windows.  I'm trying to interpret
> HOWTO-winelib,
> but without specific code examples anywhere in the tree that do this,
I'm
> having
> a hard time.  In particular, the HOWTO states:
>
> "...In order for WineLib to use the Windows DLL, certain glue code is
> needed to replace the linker magic that windows compilers use. Part of
> the glue code must be written by you. The basic idea of the glue code
> is that you write a new DLL that consists of function pointers. Each
> function in the DLL will consist of a call on a function pointer. For
> example..."
>
> (This is followed by a code fragment that makes no sense to me.)  What
> kind of
> DLL is this that I'm writing?  Is it [A] a winelib DLL that wraps calls
to
> the
> binary windows DLL?  [B] a .so that wraps the calls?  Who takes care of
> loading
> up what, and how do my calls go to the Windows DLL binary?  Is there an

The dead flat simplest way to do this is to simply have the wrappers
inline in the winelib app.  If the dll foo exports bar, the app can just
do

h = LoadLibrary("foo");
p = GetProcAddress(h, "bar");
res = p(...)
FreeLibrary(h);

Of course, LoadLibrary and FreeLibrary could be just at the start and
end of the app, and it's just the GetProcAddress that's extra.  I'm told
you can do that in windows if you want to call a function you didn't
bother to import, so it should always work with winelib, too, no matter
what other fancy import/export scheme we might develop later.

If you want to segregate the wrappers in a .so, you can do that, but
then the .so has to define the names the app will call, and contain code
to load the library (foo.dll) and get and call the address for each one,
and you need to know how to work the dynamic linker (it's not hard, but
one more thing).

> example
> of this being done anywhere in the sourcetree?

There is an example in programs/regapi, a few in programs/avitools I
haven't looked at much, and one in libtest/hello5.c.
>
> Still confused,
> Bret
>
Lawson


This message is brought to you by Wine-20000909, with the unwitting
cooperation of Juno 1.49.
---cut here




________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.

Reply via email to