Freebasic Driver Programming

Windows specific questions.
Username
Posts: 9
Joined: Jun 22, 2020 5:56

Freebasic Driver Programming

Postby Username » Jun 30, 2020 3:33

Can i make windows drivers with freebasic?
adeyblue
Posts: 25
Joined: Nov 07, 2019 20:08

Re: Freebasic Driver Programming

Postby adeyblue » Jun 30, 2020 21:01

Not practically. None of the kernel mode headers have been translated (though the libs are provided), and you can't use anything that requires the fb runtime. That includes basic things like simply declaring (much less actually using) string variables. Even then, with -nodeflibs, you'd need a different piece of startup code since the provided one is for user mode.

So technically possible, but plenty of large hoops to jump through to get there.
exagonx
Posts: 122
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: Freebasic Driver Programming

Postby exagonx » Nov 12, 2020 21:00

Username wrote:Can i make windows drivers with freebasic?


Device drivers are typically written in C, using the Driver Development Kit (DDK).
There are functional and object-oriented ways to program drivers, depending on the language chosen to write in.
It is generally not possible to program a driver in Visual Basic or other high-level languages like FreeBASIC .
caseih
Posts: 1562
Joined: Feb 26, 2007 5:32

Re: Freebasic Driver Programming

Postby caseih » Nov 13, 2020 2:27

FB is not Visual Basic. FB is closer to C, and can access anything that C can. If one translated the DDK header files to FB, there's absolutely no reason why you couldn't use FB to do that. However you'd probably want to use just the subset of FB features that translate 1:1 to C. No dynamic strings, no arrays, etc. Nothing from the FB runtime library.
exagonx
Posts: 122
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: Freebasic Driver Programming

Postby exagonx » Nov 13, 2020 7:19

caseih wrote:FB is not Visual Basic. FB is closer to C, and can access anything that C can. If one translated the DDK header files to FB, there's absolutely no reason why you couldn't use FB to do that. However you'd probably want to use just the subset of FB features that translate 1:1 to C. No dynamic strings, no arrays, etc. Nothing from the FB runtime library.


You are right caseih, I also created a library that allowed me to control a card on the parallel port, but I had to write most of the code in assembler language, it's okay to say that I used freeBASIC but I hardly wrote anything in freeBASIC , although lately FreeBASIC tends to look like GCC.

However, with windows it's another thing, to be able to do many things I had to include libraries written in C because writing a header in FreeBASIC that did the same things was too expensive and complicated (at least for me)
marcov
Posts: 3020
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Freebasic Driver Programming

Postby marcov » Nov 13, 2020 16:05

exagonx wrote:
Username wrote:Can i make windows drivers with freebasic?


Device drivers are typically written in C, using the Driver Development Kit (DDK).
There are functional and object-oriented ways to program drivers, depending on the language chosen to write in.
It is generally not possible to program a driver in Visual Basic or other high-level languages like FreeBASIC .


Note also that afaik you need to develop for the (native)NT target, iow, no win32 (user32,kernel32) or libraries that depend on that (like msvcrt). The C backend thus also would have to work with a non gcc compiler (or the GAS port needs an additional target)

Maybe if you can go through the DDK's native NT C compiler you can workaround platform support, but you might also need to reduce the RTS for that. Some calls from those libs might also be available in NTDLL though.

Most of this knowledge is very old (2007 based on older (2003) SDKs), I also mostly only read about it in threads on a forum, never tried myself. Maybe MS has made it easier meanwhile.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 6 guests