CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: best language for writing drivers?

  1. #1
    Join Date
    Mar 2015
    Posts
    14

    Question best language for writing drivers?

    I want to really get into writing drivers and want to know if one language is better than another for this. I understand of course that any language would do just fine but is there a standard?

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: best language for writing drivers?

    If you want to write kernel mode drivers...
    C and C++ are you only 2 viable options.
    writing your driver in pure assembly is also a possibility but that is going to be very very tedious.


    if you want to write user mode drivers...
    the same as above,
    I've heard of some people writing drivers in Delphi but it's a lot of effort since the produced binaries aren't in the right format, so you'll need to write (or obtain) the necessary conversion tools to wrap your PE image into the driver format and link the driver header to the PE image.

    if you mean driver hooks, then there are options for a few languages, though it may need the install of a special driver (or virtual driver) that allows these hooks int he first place. Only a few of the driver models in Windows support native OS hooks.


    unless you mean "services" and not "drivers". Services can be written in practically everything, including powershell scripts and VBS (using svrany.exe to install them into the service chain).


    From a technical POV, any language that can:
    - produce a DLL in PE format
    - supports function pointers (for the DRIVER_OBJECT hookups)
    - supports STDCALL linkage (__fastcall for win64) both for calling functions and for exporting.
    - where it's runtime does NOT have external dependancies other than the driver framework approved DLL's.
    - your own code equally can't use DLL's other than those approved ones, but you have control over that.
    It's mostly issue 4 that will be the show stopper for typical languages.
    note that for driver development in C/C++, you can't use the normal C/C++ runtime. you need the driver variant thereof.
    Last edited by OReubens; March 13th, 2015 at 09:02 AM.

  3. #3
    Join Date
    Mar 2015
    Posts
    14

    Re: best language for writing drivers?

    Thanks for the info. I was thinking c++ but I wasn't sure.

  4. #4

    Re: best language for writing drivers?

    Video card drivers use C/C++ and Assembly language. If you're thinking of making a driver, then you should know that you'll probably never get the proper hardware programming information that you need to build one.
    Last edited by bestellen; September 15th, 2015 at 04:14 PM.

  5. #5
    Join Date
    Apr 2015
    Posts
    3

    Re: best language for writing drivers?

    As I know in order to write device drivers people usually use c++ or assembly? ... feature of C++ programming language that is necessary for writing drivers? ... as the best C code but provide higher level abstractions as well.

  6. #6

    Re: best language for writing drivers?

    1. The pro way: get Borland C++ Builder and use CLX Application to write for Unix platforms..

    2. The 'homemade' way : get the free compiler DJGPP (C language)
    Last edited by bestellen; September 15th, 2015 at 04:16 PM.

  7. #7
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: best language for writing drivers?

    He asked in the VS forums
    so this is about WIndows kernel drivers
    so your suggestion makes no sense.

    For windows, C++ is easiest, but you'll need the DDK because you'll need the "driver stub" and right runtime library to have the C++ code hookup into the driver framework.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)