R
Ritu
Hi All,
Can any body please tell me how i can write a device driver using CSharp.
Thanks,
Ritu
Can any body please tell me how i can write a device driver using CSharp.
Thanks,
Ritu
Nicholas Paldino said:Pete,
While you can not write device drivers directly in .NET, that doesn't
mean you can't use them.
C# does not have the ability to export functions from DLLs. This is
the reason you can not write device drivers with C#.
That doesn't stop you from creating an unmanaged dll and then calling
.NET code from within that. However, for device drivers, this is
something you definitely don't want to do.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Pete Davis said:You can't write device drivers in managed code, therefore you can't write
a device driver in C#.
You'll need to write it in either assembly or unmanaged C/C++.
Pete
Willy Denoyette said:Inline
Willy.
message news:[email protected]...Pete,
While you can not write device drivers directly in .NET, that doesn't
mean you can't use them.
C# does not have the ability to export functions from DLLs. This is
the reason you can not write device drivers with C#.
This is not the only reason though, the only kernel mode driver development
environment supported by MSFT is the driver development kit, it uses it's
own set of tools like C++ compiler and linker (the latest version 13.10) and
it's own set of libraries (not necessarily the same as the VS or sdk libs.).
You can't use template classes and the C++ template libraries, great care
must be taken when using the standard C library when doing kernel mode
development, some functions should not be called at all, so you should not
use frameworks build in top of the C++ and C runtime libary (like the CLR).
You should not introduce the COM library (ole32.dll) into kernel mode driver
(like the CLR does) nor should you use other high level C++ based frameworks
like ATL and MFC.
Another restriction is that device drivers must use structured exception
handling and NOT something built on top of it like C++ exceptions (like the
C++ template lib.) and CLR exceptions. And don't forget, device drivers
cannot stand asynchronous exceptions ;-).
And last but not least they have very restrictive memory constraints, you
can't run device drivers that allocate 32 MB heap (in kernel space) space
for the GC heap, he you can't (or shouldn't) even use malloc or new.
So you see, this is not the place to be for managed code.
That doesn't stop you from creating an unmanaged dll and then calling
.NET code from within that. However, for device drivers, this is
something you definitely don't want to do.
And what would be the purpose of this unmanaged DLL?
C# applications can directly call into device drivers IOCTL interface
through PInvoke.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Pete Davis said:You can't write device drivers in managed code, therefore you can't write
a device driver in C#.
You'll need to write it in either assembly or unmanaged C/C++.
Pete
Hi All,
Can any body please tell me how i can write a device driver using
CSharp.
Thanks,
Ritu
Nicholas Paldino said:Pete,
While you can not write device drivers directly in .NET, that doesn't
mean you can't use them.
C# does not have the ability to export functions from DLLs. This is the
reason you can not write device drivers with C#.
That doesn't stop you from creating an unmanaged dll and then calling
.NET code from within that. However, for device drivers, this is something
you definitely don't want to do.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Pete Davis said:You can't write device drivers in managed code, therefore you can't write
a device driver in C#.
You'll need to write it in either assembly or unmanaged C/C++.
Pete
Ritu said:If i cannot expose Funtions form DLl, How i can support an API Interface.
I need to write a DLL which should be able to expose some functions as
well
as GUI screens. Any client
should be able to use the GUI and the functions exposed by the DLL.
Please suggest How should i go about it Using C#.
Thanks in Advance,
Ritu
in
message news:[email protected]...Pete,
While you can not write device drivers directly in .NET, that doesn't
mean you can't use them.
C# does not have the ability to export functions from DLLs. This is the
reason you can not write device drivers with C#.
That doesn't stop you from creating an unmanaged dll and then calling
.NET code from within that. However, for device drivers, this is something
you definitely don't want to do.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Pete Davis said:You can't write device drivers in managed code, therefore you can't write
a device driver in C#.
You'll need to write it in either assembly or unmanaged C/C++.
Pete
Hi All,
Can any body please tell me how i can write a device driver using CSharp.
Thanks,
Ritu