Files
gdnative-demos/c/instance_binding
geekrelief 7996654ff2 Updated the C demos
- removed godot_headers submodule
- updated c submodules to godot-headers
- updated SConstruct to compile with windows and godot-headers submodule, msvc was not picked up properly
- updated api for instance_binding.c so it compiles
2021-04-07 16:10:15 -04:00
..
2021-04-07 16:10:15 -04:00
2021-04-07 16:10:15 -04:00
2020-08-31 00:12:51 -04:00
2021-04-07 16:10:15 -04:00

Instance binding demo using C

Dependencies:

  • You need Godot headers, this is now a submodule of this repo.
  • clang, gcc, or any decent C compiler that's C11 or C99 compatible.

Compile with SCons (cross platform)

You can use SCons to compile the library if you have it installed:

scons platform=PLATFORM

Where platform is: windows, linuxbsd, or macos

Manually compiling

Linux

To compile the library on Linux, do

cd src
clang -std=c11 -fPIC -c -I../godot_headers instance_binding.c -o instance_binding.os
clang -shared instance_binding.os -o ../project/gdnative/linuxbsd/libinstance_binding.so

This creates the file libinstance_binding.so in the project/gdnative/linuxbsd directory.

macOS

On macOS:

cd src
clang -std=c11 -fPIC -c -I../godot_headers instance_binding.c -o instance_binding.os -arch x86_64
clang -dynamiclib instance_binding.os -o ../project/gdnative/macos/libinstance_binding.dylib -arch x86_64

This creates the file libinstance_binding.dylib in the project/gdnative/macos directory.

Windows

On Windows:

cd src
cl /Foinstance_binding.obj /c instance_binding.c /nologo -EHsc -DNDEBUG /MD /I. /I../godot_headers
link /nologo /dll /out:..\project\gdnative\windows\libinstance_binding.dll /implib:..\project\gdnative\windows\libinstance_binding.lib instance_binding.obj

This creates the file libinstance_binding.dll in the project/gdnative/windows directory.