Does kernel mode support dll which export a class?

Does kernel mode support dll which export a class?
Who can give me an sample or document?
Thanks very much.

Sun Jiajie wrote:

Does kernel mode support dll which export a class?
Who can give me an sample or document?

What do you mean by “export a class”? You can certainly export C++
methods from a kernel DLL. They’re just normal entry points with long
names. You’ll need a DllEntry entry point, like all kernel DLLs.

For better encapsulation, you might consider using a more COM-like
solution, where you create a pure virtual “interface” class containing
all the entry points you need, then deriving the implementation from
that, and exporting a CreateMyObject function from the DLL.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The kernel doesn’t care what the exports are, just each of the exports
names. When you export by class, you are tying yourself to a specific
version of the processor for both the DLL and the driver which uses the
the export. Why? b/c C++ class naming (e.g. name mangling) is private
to the compiler and not standardized. This is a very fragile path to
choose. You should instead export normal C functions whose names are
standardized.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sun Jiajie
Sent: Wednesday, April 12, 2006 11:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Does kernel mode support dll which export a class?

Does kernel mode support dll which export a class?
Who can give me an sample or document?
Thanks very much.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> For better encapsulation, you might consider using a more COM-like

solution, where you create a pure virtual “interface” class containing
all the entry points you need, then deriving the implementation from
that, and exporting a CreateMyObject function from the DLL.

Yes, this is always by far better then exporting any classes from the DLL.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Always” might be a bit strong. If you’re only ever going to use this
export driver with a driver of your own that happens to be written in
C++ (and uses the same compiler, and it built at the same time, and are
always distributed together), it can be quite a bit more convenient to
export the class interface.

I can live with “almost always”, though :-).

Maxim S. Shatskih wrote:

> For better encapsulation, you might consider using a more COM-like
> solution, where you create a pure virtual “interface” class containing
> all the entry points you need, then deriving the implementation from
> that, and exporting a CreateMyObject function from the DLL.

Yes, this is always by far better then exporting any classes from the DLL.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Ray