win32 from C#

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
 
D

David Browne

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
 
K

Kamil

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

Kamil
 
N

newscorrespondent

Why not write a C# class that has all the interfaces to WIN32 you need and
then reference that class?
 
H

hB

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top