Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6172969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:29:09+00:00 2026-05-23T23:29:09+00:00

Need to send some data between managed c# and unmanaged c++. After some research

  • 0

Need to send some data between managed c# and unmanaged c++. After some research
I tried to use Protobuf.NET.

I’m not sure if I understand functionality of ProtoBuf…

  1. Build a type definition in Proto. I need this type definition in both projects c++ and c#
  2. Use the command-line tool “protogen.exe” to get an .cs file and .cpp, .h from the type definition
  3. Copy the .cs files into my c# project and the .cpp, .h in my c++ solution.

Seems I’m to stupid to to solve this. Here are my problem and questions.

  1. Is it possible to define the type in c# to generate the files in for c++ ?
  2. Tried to use the command-line tool protogen.exe with the following files

test1.proto

using ProtoBuf;
namespace ProtocolBuffers
{
    [ProtoContract]
    class Person
    {
        [ProtoMember(1)]
        public int Id {get;set;}
        [ProtoMember(2)]
        public string Name { get; set; }
    }
}

test2.proto

message Person {
  required int32 id = 1;
  required string name = 2;
  optional string email = 3;
}

Nothing is working for me. Really tried everything. I put the proto files into the
commandline dir, tried every option to set the dir. How to build them easily ?
The second file is working with standard proto commandline tool for c++ but i need it for c# too. Really need your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:29:09+00:00Added an answer on May 23, 2026 at 11:29 pm

    Firstly, note that protobuf-net is just one available implementation for .NET; anyway…

    “test1.proto” is not a .proto – it is C#; a .proto is not required for use with protobuf-net, but in your interop scenario it is a very good idea. There is VS2010 plugin for this, or alternatively the protogen tool that is in the protobuf-net zip:

     protogen -i:test2.proto -o:test2.cs
    

    This should generate test2.cs with the contents:

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    // Generated from: test2.proto
    namespace test2
    {
      [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"Person")]
      public partial class Person : global::ProtoBuf.IExtensible
      {
        public Person() {}
    
        private int _id;
        [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
        public int id
        {
          get { return _id; }
          set { _id = value; }
        }
        private string _name;
        [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)]
        public string name
        {
          get { return _name; }
          set { _name = value; }
        }
    
        private string _email = "";
        [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"email", DataFormat = global::ProtoBuf.DataFormat.Default)]
        [global::System.ComponentModel.DefaultValue("")]
        public string email
        {
          get { return _email; }
          set { _email = value; }
        }
        private global::ProtoBuf.IExtension extensionObject;
        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
          { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
      }
    
    }
    

    Note that there are additional switches if you want, for example, it to attempt case normalization (so you get Id, Name, Email, etc), or want it to include additional serializer support (BinaryFormatter, DataContractSerializer, etc)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send some data to a user after they log in to
I need to basically send some data to 98.136.86.109 at port 587. How can
I need to send an apex web service some data. Then name of the
I'm building a fairly simple PHP script that will need to send some emails
I need to send and receive data over serial connections (RS-232 and RS-422). How
I have upcoming project where we need application to send data on compressed into
every time i am writing some data to my server i first send a
I have some data stored on client side which I need to fetch thru
I need to send a string to server. That string is having some special
I need to send hundreds of newsletters, but would like to check first if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.