I want to use a c++ library that among many other things have a function 
that generates a proto object.

MyProtoMessage GetMyProto() {
   MyProtoMessage p;
   ...
   return p;
}

Currently this method and its callers are all in C++.

I want to call that same method from Go and want to get back the generated 
MyProtoMessage 
in Go so I can process it in Go. What is the most efficient way of doing 
this? 

Do I need to:
1- Create a new function f1 in C++ that will:
- manually allocate a byte[] in the C++ code, 
- call GetMyProto()
- serialize MyProtoMessage into the byte[].
- return the a pointer and size to when called from Go

2- In Go copy that C byte[] into a Go []byte

3- Call C.free(pointer) to free the memory?

Any more efficient way of doing this?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to