I am trying to write a go library that will act as a front-end for a C library. If one of my C structures contains a size_t
, I get compilation errors. AFAIK size_t is a built-in C type, so why wouldn't go recognize it?
My header file looks like:
typedef struct mystruct
{
char * buffer;
size_t buffer_size;
size_t * length;
} mystruct;
and the errors I'm getting are:
gcc failed:
In file included from <stdin>:5:
mydll.h:4: error: expected specifier-qualifier-list before 'size_t'
on input:
typedef struct { char *p; int n; } _GoString_;
_GoString_ GoString(char *p);
char *CString(_GoString_);
#include "mydll.h"
I've even tried adding either of // typedef unsigned long size_t
or // #define size_t unsigned long
in the .go file before the // #include
, and then I get "gcc produced no output".
I have seen these questions, and looked over the example with no success.