using .h files in C#

G

Guest

Hi
I am writing a windows application in C# and I want to use some header files from a C++ program in my C# code.
How can I do this??

Thanks and Regards
MVB
 
A

Alvin Bruney [MVP]

a .h file is a class definition. you can use a class library for that or
just a plane namespace.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
MVB said:
What approach do I need to use to perform the similar action.
How do I incorporate the code in .h to my C# code.
will marshalling help?

please reply

Thanks and regards
MVB

Alvin Bruney said:
that approach is antiquated.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
MVB said:
Hi
I am writing a windows application in C# and I want to use some header
files from a C++ program in my C# code.
How can I do this??

Thanks and Regards
MVB
 
N

Nick Malik

You don't need them.

If you are calling a C++ object, and you need a type that is defined in a
header file, you should create a C# wrapper class that provides, as part of
the C# code, an alternate definition for the type.

The C# compiler neither wants to use header files, nor does it need them.
Most of the problem is solved by having .NET look up the definition of the
managed code call, using namespaces, at compile time (and, in a good IDE, at
coding time :).

In other words, you can't use the header definitions in the include file in
C#. Code it again.

Sorry,
--- Nick

MVB said:
Hi
I am writing a windows application in C# and I want to use some header
files from a C++ program in my C# code.
 

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