I wanna use precomplied c++ library. I make test project for it.
Mac OS Sierra Apple LLVM version 8.0.0 (clang-800.0.42.1) GO: go1.8.3 darwin/amd64 SWIG Version 3.0.12 swig -c++ -go -soname libapple.dylib -use-shlib -intgosize 64 core/Apple.i And I see Apple_gc.c and wanna compile with 6c(go tool compile) /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.12 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ /* source: core/Apple.i */ /* This file should be compiled with 6c/8c. */ #pragma dynimport _ _ "libapple.dylib" #include "runtime.h" #include "cgocall.h" #pragma dataflag 16 static void *cgocall = runtime·cgocall; #pragma dataflag 16 void *·_cgo_runtime_cgocall = &cgocall; #pragma dynimport _wrap_Swig_free_sdsd_174c5afe4e48040e _wrap_Swig_free_sdsd_174c5afe4e48040e "" #pragma cgo_import_static _wrap_Swig_free_sdsd_174c5afe4e48040e extern void _wrap_Swig_free_sdsd_174c5afe4e48040e(void*); uintptr ·_wrap_Swig_free_sdsd_174c5afe4e48040e = (uintptr)_wrap_Swig_free_sdsd_174c5afe4e48040e; #pragma dynimport _wrap_Swig_malloc_sdsd_174c5afe4e48040e _wrap_Swig_malloc_sdsd_174c5afe4e48040e "" #pragma cgo_import_static _wrap_Swig_malloc_sdsd_174c5afe4e48040e extern void _wrap_Swig_malloc_sdsd_174c5afe4e48040e(void*); uintptr ·_wrap_Swig_malloc_sdsd_174c5afe4e48040e = (uintptr)_wrap_Swig_malloc_sdsd_174c5afe4e48040e; #pragma dynimport _wrap_Sum_sdsd_174c5afe4e48040e _wrap_Sum_sdsd_174c5afe4e48040e "" #pragma cgo_import_static _wrap_Sum_sdsd_174c5afe4e48040e extern void _wrap_Sum_sdsd_174c5afe4e48040e(void*); uintptr ·_wrap_Sum_sdsd_174c5afe4e48040e = (uintptr)_wrap_Sum_sdsd_174c5afe4e48040e; But go tool compile Apple_gc.c shows: Apple_gc.c:15: illegal character U+0023 '#' Apple_gc.c:15: syntax error: package statement must be first Why? PS. File strange with '·' chars Also I have tried: g++ / gcc commands first g++ / gcc -c -fpic Apple.cpp g++ / gcc -c -fpic Apple_wrap.cxx g++ / gcc -shared Apple.o Apple_wrap.o -o Apple.so Undefined symbols for architecture x86_64: "__cgo_topofstack", referenced from: _swig_topofstack() in Apple_wrap.o ld: symbol(s) not found for architecture x86_64 -- 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.