(mtool) C:\MMD\mlib_go\backend>go mod init github.com/miu200521358/mlib_go
go: creating new go.mod: module github.com/miu200521358/mlib_go
- VSCode に go 拡張をいれる
golang.go - コマンドプロンプトで下記を実行(× Power Shell)
- https://jmeubank.github.io/tdm-gcc/download/ をインストール
Minimal online installer.(多分最初のexeボタン)- PATH に TDM-GCC-64 までのパスを追加
- go.mod の最後の3行(replaceのとこ)をコメントアウト
- 開発用にローカルのを参照しているため
- ライブラリインポート
set GOOS=windowsset GOARCH=amd64set CGO_ENABLED=1go mod tidy
- ビルドできるはず
set CGO_ENABLED=1go run main.gogo build -o ../build/mlib.exe main.go
- ビルドできたらVSCode再起動で run もできるようになってるはず
go clean --modcache
go clean -cache
go clean -testcache
go fmt ./...
- .icoファイルを作成
- .rcファイルを作成
IDI_ICON1 ICON DISCARDABLE "app.ico"
- .resファイルにコンパイル
windres -O coff -o app.res app.rc
- ビルドスクリプトで実行
go run crumb/profile.gogo tool pprof crumb\profile.go crumb\cpu.pprofgo tool pprof -flat crumb\profile.go crumb\cpu.pprofgo tool pprof -cum crumb\profile.go crumb\cpu.pprofgo tool pprof -http=:8080 cpu.pprof
(pprof) top- プロファイル: ISAOミク+Addiction
go get github.com/goccy/go-graphviz/cmd/dotgo install github.com/goccy/go-graphvizgo tool pprof -http=:8081 mem.pprof
-
swig インストール https://rinatz.github.io/swigdoc/abstract.html
-
変換コード作成
(mtool) C:\MMD\mlib_go\pkg\infrastructure\bt>swig -c++ -go -cgo -I"C:\MMD\mlib_go\pkg\infrastructure\bt\bullet\src" -I"C:\development\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\10.3.0\include\c++\x86_64-w64-mingw32" -I"C:\development\TDM-GCC-64\x86_64-w64-mingw32\include" -I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" -cpperraswarn -o "C:\MMD\mlib_go\pkg\infrastructure\bt\bt.cxx" "C:\MMD\mlib_go\pkg\infrastructure\bt\bullet.i"
go list -m -mod=mod -versions github.com/miu200521358/dds
go list -m -mod=mod -versions github.com/miu200521358/win
go list -m -mod=mod -versions github.com/miu200521358/walk
set GOGC=1000set GODEBUG=gctrace=1(mtool) C:\MMD\mlib_go\crumb>go run profile.gogo tool pprof profile.go cpu.pprofgo tool pprof -http=:8080 cpu.pprof