draffensperger / go-interlang Goto Github PK
View Code? Open in Web Editor NEWExamples of calls between Go and C/C++ (and how to call a Go shared object from Node/Ruby/Python/Java)
Examples of calls between Go and C/C++ (and how to call a Go shared object from Node/Ruby/Python/Java)
Hi,
do you know how I can call and link an external c/c++ library in callback or adder?
I can call from the main, but not in the .c/.h files of the callback project.
Thanks a lot
Angelo
I know we can call C++ from Go using SWIG.
But can we call Go From C++ using SWIG?
I am trying to write a wrapper for this:
https://github.com/TommyKaneko/Sketchup-API-C-Wrapper
They have a c and cpp wrapper over the c.
SO which is easier from a golang perspective ?
Would really appreciate your advice as I have never really done much of this golang to c work before.
Hi,
Any ideas on how to write a golang equivalent struct for self referencing struct something like this -
typedef struct WRITER {
int version;
int (WriteBlock)(struct WRITER thisPtr,
const void* dataBufferPtr,
unsigned long bufferSize);
} WRITER;
Thanks.
I followed your example in cxx_to_go_dyn_lib. I want to export go functions in infiniband go module so that they are callable from C++. I manage to generate the .h header files but when I compile my C++ code it bumps out with the following error:
./src/github.com/jsgilmore/ib/libadder.so(_all.o): In function Initialize': /tmp/go-build/github.com/jsgilmore/ib/_obj/_cgo_export.c:33: undefined reference to
_cgo_wait_runtime_init_done'
/tmp/go-build/github.com/jsgilmore/ib/_obj/_cgo_export.c:38: undefined reference to `_cgoexp_1f5f6ba4e969_Initialize'
Didn't get much help from the internet on this error. I will appreciate your input.
P.S. The file that contains the the exported go functions has an "import C" declaration with commented includes. Could this be an issue?
Is there a way to ensure that the generated header files (.h files) have function parameters and structs with meaningful variable names? What I notice is that cgo just follows some pattern e.g., r0, r1... or p0, p1...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.