slembcke / Chipmunk2D

A fast and lightweight 2D game physics library.
http://chipmunk2d.net
MIT License
2.21k stars 352 forks source link

Fix MSVC dll import/export #229

Open airbrett opened 2 years ago

airbrett commented 2 years ago

Problem: When building a dll on Windows with MSVC some symbols are not exported while others are exported with C++ name mangling rather than C.

Solution: Add CP_EXPORT to functions not exported. Add define block to handle declspec(dllexport) and declspec(dllimport). Note: this solution requires a new define added to instruct the compiler to look for a shared library or a static library. This only applies when _WIN32 is defined.

This may fix #194, #116 and possibly #121