Tuesday, October 8, 2024
HomeGolangThe way to go 'C' embody listing to go construct - Getting...

The way to go ‘C’ embody listing to go construct – Getting Assist


Hello,

I’m tryng to wrap a ‘C’ library to be used with go.

I’ve acquired a legitimate swig .i file, and I’ve acquired so far as:

go mod init skirmish-dev.web/sgd
swig -go -I../embody sgd.i
go construct

…at which level I get an error:

sgd_wrap.c:211:10: deadly error: sgd/sgd.h: No such file or listing
  211 | #embody <sgd/sgd.h>

The issue seems to be that I haven’t handed the embody listing for sgd/sgd.h to ‘go construct’ the way in which I’ve to ‘swig’. I’ve tried -Iblah with go construct however it offers an error.

I’ve tried to compile the sgd_wrap.c file generated by swig with gcc however it doesn’t construct, it truly doesn’t seem like legitimate ‘C’.

I there some solution to go embody directories to go construct, or another solution to construct the sgd_wrap.c file?

As you’ve in all probability guessed, I’m very new to go!

Bye,
Mark

Okay, simply tried copying the headers information into the identical listing because the module and I get a bit additional, however ‘go construct’ now fails with the identical errors I get when making an attempt to construct with plain gcc. Listed below are just a few of these errors, however there are a whole lot…

In file included from sgd_wrap.c:179:
c:usersmarksdevmingwx86_64-w64-mingw32includestring.h:50:45: word: anticipated 'void * prohibit' however argument is of kind 'SGD_String' {aka 'const char *'}
   50 |   void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                         ~~~~~~~~~~~~~~~~~~~~^~~~
sgd_wrap.c:1895:22: error: project of read-only location '*(arg1 + (sizetype)_swig_go_0.n)'
 1895 |   arg1[_swig_go_0.n] = '';
      |                      ^
sgd_wrap.c:1901:8: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer goal kind [-Wdiscarded-qualifiers]
 1901 |   free(arg1);
      |        ^~~~
In file included from sgd_wrap.c:178:
c:usersmarksdevmingwx86_64-w64-mingw32includestdlib.h:536:27: word: anticipated 'void *' however argument is of kind 'SGD_String' {aka 'const char *'}
  536 |   void __cdecl free(void *_Memory);
      |                     ~~~~~~^~~~~~~
sgd_wrap.c: In operate '_wrap_LoadSkybox_sgd_f7b3eb29aefada5b':
sgd_wrap.c:1984:10: warning: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer goal kind [-Wdiscarded-qualifiers]
 1984 |   memcpy(arg1, _swig_go_0.p, _swig_go_0.n);
      |          ^~~~

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments