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

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

  1. b.lu

    b.lu 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,
    Blu.
     
    b.lu, Apr 30, 2006
    #1
    1. Advertisements

  2. b.lu

    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
    #2
    1. Advertisements

  3. b.lu

    b.lu Guest

    Dear Skywing,
    thank you for your answer.

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

    Thank you,
    Blu


    Skywing ha scritto:
     
    b.lu, Apr 30, 2006
    #3
  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.

    d
     
    Doron Holan [MS], Apr 30, 2006
    #4
  5. b.lu

    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
    parameter.


    =====================
    Mark Roddy DDK MVP
    Windows Vista/2003/XP/2000 Consulting
    Device and Filesystem Drivers
    Hollis Technology Solutions 603-321-1032
    www.hollistech.com
     
    Mark Roddy, Apr 30, 2006
    #5
    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.