On 2022-06-13 01:57, Bijan Soleymani wrote:
On 2022-05-30 13:01, Susmita/Rajib wrote:
I was trying to find out if c++ could be used to build device drivers.
You said, "... Linux drivers are written in C, but technically you can
mix languages: use C++ and link it against C ...". But I would request
more specificity here:    (a)  if c++ could be used without using any
other programming language to build a device driver. (b)  If it is
practised industrially.

I work on a kernel mode driver for windows. It is written in C++. But
we can't use the C++ standard library, as Windows kernel mode doesn't
support exceptions. I think someone managed to make a version that did
but it never ended up being good enough to catch on.

Sorry this last bit wasn't clear. Someone made a version of the standard library that didn't use exceptions. But it wasn't that useful probably because of all the other limitations I mentioned.

Also before this I worked on a user space mobile app library. The initial version was in Java with only the cryptography done in C and accessed via JNI. This was because we started on Android and the server was written in Java.

But iOS (iPhones) doesn't run Java, so we had to move the core to C, and access that from Java/Kotlin on Android using JNI and from objective C/swift on iOS using the standard C interface.

Otherwise the Android and iOS implementations would need to be duplicated.

We could have done the core in C++ or objective C, but C had less headaches with portability.

Before this I worked on another project in perl (my code) and ruby (an existing software component) on Linux but it needed heavy access to OS syscalls to monitor file accesses (inotify), and so I had to have a C/C++ component that did the file access monitoring that the ruby/perl code needed to communicate with.

Bijan

Reply via email to