help on creating C or C++ wrapper

V

Vaughn

Where can I find information on writing a C/C++ wrapper in Dot Net? I have
good experience in C (not so much in C++) so I'm thinking of writing it in
C. The wrapper's going to be used for some dll functions (also written in
C) that we need for our C# application. It's really going to be really
simple since the functions are pretty simple.
I'm interested in knowing how I should start (New Project, New Blank
Solution, etc...) and what I should do from there. I tried starting one with
VC++ 6 but the first problem I got was that the file the project creates has
extension *.cpp when it should really be *.c

Thanks for the help,
Vaughn
 
W

Willy Denoyette [MVP]

Why do you need to write a wrapper, you can simply call your C functions
from C# using PInvoke (see Dllimport).
Writing a managed wrapper can only be done using VC++ 7.x., vc6 doesn't know
anything about managed code.

Willy.
 
V

Vaughn

We tried it but with little success. One of the functions, the most
essential one, uses a struct which includes an array of struct and C#
doesn't know how to handle this very well. We even tried custom marshalling
but the marshalling got too complex for us.
So how would we begin to create a C wrapper in VC++ 7.x?


Thanks.
 

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