Red Gate forums :: View topic - How to use C++ declarations in C# or vice versa?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
PInvoke.Net
PInvoke.Net forum

How to use C++ declarations in C# or vice versa?

Search in PInvoke.Net forum
Post new topic   Reply to topic
Jump to:  
Author Message
Rambutan



Joined: 26 Jul 2007
Posts: 1

PostPosted: Thu Jul 26, 2007 5:21 pm    Post subject: How to use C++ declarations in C# or vice versa? Reply with quote

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
View user's profile Send private message
Robert



Joined: 30 Oct 2006
Posts: 428
Location: Cambridge, UK

PostPosted: Thu Jul 26, 2007 8:22 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Reply to topic 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