C++ Structures in C#
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: C++ Structures in C#

  1. #1
    Join Date
    Apr 2006
    Posts
    5

    Question C++ Structures in C#

    I have a question about C++ and C#:

    Sitation:
    We have a lot of C++-classes(structs) we use for storing Data.

    They look like this:

    struct StJumTo
    {
    double dX;
    double dY;
    int iZoom;

    Set(double dX, double dY, double dZoom);
    SetDefault(double dX, double dY);
    };

    All in all we use a lot of them(~500) in our actual code. All have different Membervariables and different function So changing them is no good option.

    So now my question:
    Is there a way to access all this structures out of C# without writing a warperclass for each struct?
    Important is that we get a compiler or linker error if someone uses a variable witch does not exist in c++.

  2. #2
    Join Date
    Sep 2009
    Posts
    23

    Re: C++ Structures in C#

    I think that in your case the best solution that I can see is to make a tool tat will translate all your classes(structures) in .Net wrappers. Text processing tool. It seems to me not very difficult. As I can understand there is no way to use native structs in C# with no c++/cli wrappers.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center