KMDF Interface : is it possible to use a c++ class ?

Discussion in 'Windows Vista Drivers' started by, Apr 30, 2006.

  1. Guest

    Dear all,
    I'm developing a driver similar to Toaster example using Kernel Mode
    Driver Framework.

    Is it possible to create an interface to export a c++ class instead of c
    functions with WdfDeviceAddQueryInterface ?

    Unfortunately when I try to call class members from Function Driver
    build stop with unresolved external error (and it is obvious because
    class member are not implemented in Function Driver but only in Bus Driver).

    Thank you very much,
, Apr 30, 2006
    1. Advertisements


    Skywing Guest

    I would not recommend it. If you change the class or upgrade the compiler
    you risk breaking compatibility with existing binaries.
    Skywing, Apr 30, 2006
    1. Advertisements

  3. Guest

    Dear Skywing,
    thank you for your answer.

    I think I will not do, but how to do (it is just curiosity) ?

    Thank you,

    Skywing ha scritto:
, Apr 30, 2006
  4. if you are exporting an interface via WdfDeviceAddQueryInterface, eachof the
    function pointers you pass in must be static pointers since the caller will
    not have the this pointer.

    Doron Holan [MS], Apr 30, 2006

    Mark Roddy Guest

    The whole idea is fairly silly, but you of course can have one of your
    interface methods provide a class object pointer as an output

    Mark Roddy DDK MVP
    Windows Vista/2003/XP/2000 Consulting
    Device and Filesystem Drivers
    Hollis Technology Solutions 603-321-1032
    Mark Roddy, Apr 30, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.