Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2006

Tip: Looking for answers? Try searching our database.

c# <-> c++ interop - Array of struct

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Varun Bansal - 20 Jun 2006 03:46 GMT
Hi,

I want to return an array of structures from a C# dll to native C++ client
application. The structure looks like this:

   public struct mystruct
   {
       public string strName;
       public string strDesign;
       public bool bValid;
       public bool bLocal;
       public DateTime tMyTime;
       public TimeSpan tRetention;
   }

What's the best way to marshall the array of structure like this from C# dll
to C++ client app? A sample code will be highly appreciated.

Thanks,
Varun
Mattias Sjögren - 21 Jun 2006 21:53 GMT
>I want to return an array of structures from a C# dll to native C++ client
>application. The structure looks like this:
[quoted text clipped - 11 lines]
>What's the best way to marshall the array of structure like this from C# dll
>to C++ client app? A sample code will be highly appreciated.

Well first of all I suggest you replace the .NET specific types such
as DateTime and TimeSpan with a data format that is well defined and
can be used on the native side.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.