5

This is a C struct that I want to port into Go struct:

struct InputBuffer_t {
   char* buffer;
   size_t buffer_length;
   ssize_t input_length;
};

But there is a way to declare buffer_length variable without using C.size_t cgo pointer in Go.

This is a concern for portability. If I write the Go struct in this way, is it will be portable?

type InputBuffer struct {
   Buffer        string
   BufferLength uint32
   InputLength  uint32
};
Shajal Ahamed
  • 141
  • 2
  • 16

0 Answers0