Skip to content

Latest commit

 

History

History
63 lines (33 loc) · 2.11 KB

README.md

File metadata and controls

63 lines (33 loc) · 2.11 KB

示例 dotnet 调用 Go 类库并注册回调函数

这是一个 dotnet 调用 Go 生成的 C/C++类库示例,

目录说明

  • golang : 使用Go语 言编写的类库 goland\make.bat: 用于生成 DLL命令 golang\src\copyfile.bat: 复制DLL文件到.net 目录下

  • csharp : .net 项目

需求

  • .net 7.0
  • go 1.21.0
  • msys2-x86_64-20220603
C:\>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (Rev2, Built by MSYS2 project)

Example dotnet calls the Go library and registers callbacks

This is an example of a C/C++ class library generated by dotnet calling Go.

Dirs

  • golang: A library written in Go goland\make.bat: Used to generate DLL commands golang\src\copyfile.bat: Copy the DLL file into the.net directory

  • csharp:.net project

Requirements

-.net 7.0

  • go 1.21.0
  • msys2-x86_64-20220603