github.com/matrixorigin/matrixone@v1.2.0/cgo/README.md (about)

     1  MatrixOne CGO Kernel
     2  ===============================
     3  
     4  This directory contains cgo source code for MO.   Running
     5  make should produce two files to be used by go code.
     6  On go side, go will `include "mo.h"` and `-lmo`.   
     7  ```
     8  mo.h
     9  libmo.a
    10  ```
    11  
    12  `mo.h` should be pristine, meaning it only contains C function
    13  prototype used by go.  The only datatypes that can be passed 
    14  between go and c code are int and float/double and pointer.   
    15  Always explicitly specify int size such as `int32_t`, `uint64_t`.
    16  Do not use `int`, `long`, etc.
    17  
    18  Implementation Notes
    19  --------------------------------
    20  
    21  1. Pure C.
    22  2. Use memory passed from go.  Try not allocate memory in C code.
    23  3. Only depends on libc and libm.
    24  4. If 3rd party lib is absolutely necessary, import source code 
    25     and build from source. If 3rd party lib is C++, wrap it completely in C.