Hello,
I try to integrate Box3D to Defold as a native extension. I added the Box3D source code to the extensions folder. It is required only 15 seconds to recompile a project in Defold. Box3D is written in the pure C language. It looks like it is impossible to integrate it without changing of Box3D source code from C to C++. But Box2D was integrated to Defold and maybe it is possible for Box3D too?
Simple example that includes Box3D source code: box3d-defold-extension.zip (462.1 KB). You can just open this example and run it - you do not need to set up anything.
ext.manifext:
name: "Box3D"
platforms:
x86_64-win32:
context:
flags: [
"-fpermissive",
"-Wno-write-strings",
"-Wno-invalid-offsetof",
"-Wno-pointer-arith",
"-Wno-missing-braces",
"-Wno-deprecated",
"-Wno-c++-compat" # Suppress C vs C++ compatibility warnings
]
defines: [
"DM_PLATFORM_WINDOWS",
"DDM_DEBUG"
]
Errors:
/extensions/box3d/src/box3d/arena_allocator.c
Line 148: assigning to 'struct b3OverflowBlock *' from incompatible type 'void *'
148 | b3Array_Push( shared->overflows, block );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/extensions/box3d/src/box3d/block_allocator.c
Line 23: assigning to 'struct b3Block *' from incompatible type 'void *'
23 | b3Array_Resize( allocator.blocks, count );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Line 27: assigning to 'char *' from incompatible type 'void *'
27 | allocator.blocks.data[i].memory = b3Alloc( B3_BLOCK_SIZE * elemenclang++ -DDLIB_LOG_DOMAIN="BOX3D" -DDDF_EXPOSE_DESCRIPTORS -DDM_PLATFORM_WINDOWS -D_CRT_SECURE_NO_WARNINGS -D_CRT_USE_BUILTIN_OFFSETOF -D_WINSOCK_DEPRECATED_NO_WARNINGS -D__STDC_LIMIT_MACROS -DWINVER=0x0600 -DWIN32 -DNOMINMAX -DDM_DEBUG -DDM_PLATFORM_WINDOWS -DDDM_DEBUG -target x86_64-pc-win32-msvc -m64 -O2 -g -gcodeview -Wall -Werror=format -fvisibility=hidden -nostdinc++ -fno-exceptions -fpermissive -Wno-write-strings -Wno-invalid-offsetof -Wno-pointer-arith -Wno-missing-braces -Wno-deprecated -Wno-c++-compat -nostdinc++ -isystem /usr/lib/llvm-20/lib/clang/20/include -isystem /opt/platformsdk/Win32/MicrosoftVisualStudio2026/VC/Tools/MSVC/14.51.36231/include -isystem /opt/platformsdk/Win32/MicrosoftVisualStudio2026/VC/Tools/MSVC/14.51.36231/atlmfc/include -isystem /opt/platformsdk/Win32/WindowsKits/10/Include/10.0.28000.0/ucrt -isystem /opt/platformsdk/Win32/WindowsKits/10/Include/10.0.28000.0/winrt -isystem /opt/platformsdk/Win32/WindowsKits/10/Include/10.0.28000.0/um -isystem /opt/platformsdk/Win32/WindowsKits/10/Include/10.0.28000.0/shared -Iupload/extensions/box3d/include/ -Ibuild/box3d/ -Iupload/ -I/var/extender/sdk/f735c12192bf95684e6ae1ae27c400b8170fc6d8/defoldsdk//include -I/var/extender/sdk/f735c12192bf95684e6ae1ae27c400b8170fc6d8/defoldsdk//sdk/include -I/var/extender/sdk/f735c12192bf95684e6ae1ae27c400b8170fc6d8/defoldsdk//ext/include upload/extensions/box3d/src/box3d/contact.c -c -o build/contact.c_9.o
tSize );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Line 65: assigning to 'struct b3Block *' from incompatible type 'void *'
65 | b3Array_Resize( allocator->blocks, requiredBlockCount );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Line 69: assigning to 'char *' from incompatible type 'void *'
69 | allocator->blocks.data[i].memory = b3Alloc( B3_BLOCK_SIZE * allocator->elementSize );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~







