ShadowApex / godot-go

Go language bindings for the Godot Engine's GDNative API.
MIT License
363 stars 31 forks source link

gdnative api change on godot tip #29

Closed capnm closed 6 years ago

capnm commented 6 years ago

See the karofel's comment https://github.com/godotengine/godot/issues/12897

The python bindings I think, use now the wrapper https://github.com/godotengine/godot/blob/master/modules/gdnative/SCsub#L246 (scons gdnative_wrapper=yes)

I tried to change the Go bindings, but even that seems to be currently somewhere down the gdnative road broken. So far I managed to run my Go code only as a (-buildmode=c-archive) static module :-(

ShadowApex commented 6 years ago

I just pushed changes that should make it compatible with the new version. I also included an example Godot project in the examples.

You should be able to test it out with the following:

cd examples/pong
make
godot
capnm commented 6 years ago

Great that you are working on this!

In the project folder I have linked the latest headers from the godot source to godot_headers and got it to compile with git.diff.txt (godot tip 03c1b6be)

The problem still seems to remain the same: libgodot.so: undefined symbol: godot_vector3_is_normalized also you can't call e.g. isNormalized := C.godot_vector3_is_normalized(v.vector3) because the godot api doesn't export those symbols any more.

Edit: I figured out, how to tell cgo to link the wrapper:

cd godot
ar -xv ${godot-build}/bin/libgdnative_wrapper_code.x11.opt.tools.64.a
mv lib*.o gdn.syso

the _gdnative_wrapper_api_struct pointer still needs to be somewhere initialized

Thread 12 "godot3" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe4c88700 (LWP 25528)]
0x00007fffd911eb0a in godot_global_get_singleton () at modules/gdnative/gdnative_wrapper_code.gen.cpp:2872
2872        return _gdnative_wrapper_api_struct->godot_global_get_singleton(p_name);
(gdb) bt
#0  0x00007fffd911eb0a in godot_global_get_singleton () at modules/gdnative/gdnative_wrapper_code.gen.cpp:2872
#1  0x00007fffd9114d27 in _cgo_c00864750634_Cfunc_godot_global_get_singleton (v=0xc420057ee8) at cgo-gcc-prolog:73
ShadowApex commented 6 years ago

This should be resolved now with the new changes and should be compatible with Godot 3.0 release.