| Author |
Message |
Rambutan
Joined: 26 Jul 2007 Posts: 1
|
Posted: Thu Jul 26, 2007 5:21 pm Post subject: How to use C++ declarations in C# or vice versa? |
|
|
| From a program written in C#, I want to use a DLL written in C++ to manipulate a variety of simple structures, containing both integer and floating point data. Is there a way to gather the declarations into a single place, like the header.h file one would use if the project were written entirely in C++? The code is still evolving on both sides, and having duplicate sets of declarations for the same structures in two different places is both tedious and error-prone. |
|
| Back to top |
|
 |
Robert
Joined: 30 Oct 2006 Posts: 428 Location: Cambridge, UK
|
Posted: Thu Jul 26, 2007 8:22 pm Post subject: |
|
|
Hi,
To the best of my knowledge, there isn't a way you can share a set of declarations or headers between (unmanaged) C++ and C#. For neatness, you could group the C# P/Invoke declarations into their own static class, like a "Header.cs", which corresponds to your C++ header.h, but you'd still need to keep the two synchronized by hand.
Robert _________________ Robert Chipperfield
Developer, Red Gate Software Ltd |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group