win32 from C#

  • Thread starter Thread starter Kamil
  • Start date Start date
K

Kamil

Hello,

Maybe anyone of you know, if there is any way, other then PInvoke, to
use win32 dll in C# applications. Library that I use consists of plenty
of classes and it is very inconvenient to type DllImport all the time.
It would be much easier to add reference and put using directive at the
beginning of a code.
If it changes something I have sources of this dll.

Regards,
Kamil
 
Kamil said:
Hello,

Maybe anyone of you know, if there is any way, other then PInvoke, to use
win32 dll in C# applications. Library that I use consists of plenty of
classes and it is very inconvenient to type DllImport all the time. It
would be much easier to add reference and put using directive at the
beginning of a code.
If it changes something I have sources of this dll.


Yes, you can use managed C++ which can seamlessly interoperate with both C#
and native DLL's. It can consume the header file for the DLL, and expose a
small number of methods for the C# to access.

David
 
So I would have to create transparent .NET dll in C++/CLI which I could
later add to C# projects?

Kamil
 
Why not write a C# class that has all the interfaces to WIN32 you need and
then reference that class?
 
I would advice not to go writing your VSNet-C++ library for this
purpose, because on Pointer Issues only C# was able to call the
function but vbnet was unable to even see that function from C++.Net
dll. (strange!)

As newscorrespond... says, would be better.
-> Better you write a wrapper.

If VBNet is not your issue or pointers are not used in c++ they you can
use C++.Net!
 
Back
Top