Re: Importing classes from Dll
From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 04/02/04
- Next message: Joe Greene: "Re: Baffling problem with vc++ program"
- Previous message: Marius Prisecaru: "Re: Function name in calling CreateThread()"
- In reply to: Hari: "Re: Importing classes from Dll"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 2 Apr 2004 09:41:14 -0500
"Hari" <anonymous@discussions.microsoft.com> wrote in message
news:7109A866-0A64-477A-AB45-0494E1B2E8EF@microsoft.com
> Thanks for your reply.. still i have one doubt, by having an abstact
> class how it will work still everythinng is in the DLL right. I think
> u must be laughing. but still not clear
You see, an interface is not much more than an array of function
pointers (aka vtable). So you ask your factory function (GetObj in your
example) to provide a pointer to an array of function pointers, which
happen to point to methods of a particular class that implements the
interface. These methods are inside the DLL. Whenever you call a method
through interface pointer, the compiler calls through function pointer
in the vtable.
So in the end, there's no black magic. You could do the same thing
yourself. But the compiler neatly isolates the boring and tedious parts,
adding a syntactic sugar on top via the concept of virtual function.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
- Next message: Joe Greene: "Re: Baffling problem with vc++ program"
- Previous message: Marius Prisecaru: "Re: Function name in calling CreateThread()"
- In reply to: Hari: "Re: Importing classes from Dll"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|