Board index » delphi » HEY! - Delphi and virtual tables.. (C++ Stuff, Win 95 Game SDK stuff)

HEY! - Delphi and virtual tables.. (C++ Stuff, Win 95 Game SDK stuff)

        I've got a bit of a problem.. I've run into something I've
never tried to do before, so I'm stuck..

        I'm trying to use a dll (ddraw.dll) that uses the MS COM
interface. That is, the object has a virtual table of
procedures/functions.. Like so:

(p)->lpVtbl->QueryInterface(p, a, b)

        How the hell do I interface properly to this in Delphi? I
looked at the interfacing with dll's section in the help files, but as
this is an object based thing, I didn't think it would work to just
directly access the procedures in the dll (I could be wrong of
course.)

        Also, Query interface doesn't seem to be defined in the .h
files, as is lpVtbl not defined. This is strange.

        What I'm trying to do is to encapsulate this so that their's a
nice Delphi wrapper around the DirectX objects.. Any help would be
appreciated.

 

Re:HEY! - Delphi and virtual tables.. (C++ Stuff, Win 95 Game SDK stuff)


[Sorry if this is a duplicate, my Agent is giving me trouble]

First of all, QueryInterface is part of the interface that will be
supported by all COM objects you create. How you create them is not so
easy to explain, and an OLE book such as "Inside OLE 2" would help,
though it's definitely not beginner-friendly.

The lpVtbl is a pointer to the VMT (virtual method table), called Vtbl
in the C++ world, which is an array of pointers to methods. C
programmers must create those manually, but C++ compilers and Delphi
create them automatically for all virtual methods. Again, a book would
help here, and also (to a lesser extent) OLE2.INT in the DOC
directory.

Good luck,
Ido Feldmann
(feld...@ibm.net).

On Sun, 25 Feb 1996 01:24:00 GMT, mask...@quadrant.net (Jason Maskell)
wrote:

Quote
>    I've got a bit of a problem.. I've run into something I've
>never tried to do before, so I'm stuck..

>    I'm trying to use a dll (ddraw.dll) that uses the MS COM
>interface. That is, the object has a virtual table of
>procedures/functions.. Like so:

>(p)->lpVtbl->QueryInterface(p, a, b)

>    How the hell do I interface properly to this in Delphi? I
>looked at the interfacing with dll's section in the help files, but as
>this is an object based thing, I didn't think it would work to just
>directly access the procedures in the dll (I could be wrong of
>course.)

>    Also, Query interface doesn't seem to be defined in the .h
>files, as is lpVtbl not defined. This is strange.

>    What I'm trying to do is to encapsulate this so that their's a
>nice Delphi wrapper around the DirectX objects.. Any help would be
>appreciated.

Other Threads