diff --git a/CInterface/Library/PokemonSpecies.cpp b/CInterface/Library/PokemonSpecies.cpp index 20408a8..6f95d33 100644 --- a/CInterface/Library/PokemonSpecies.cpp +++ b/CInterface/Library/PokemonSpecies.cpp @@ -2,13 +2,12 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export const PokemonSpecies* PkmnLib_PokemonSpecies_Construct(uint16_t id, const char* name, - const PokemonForme* defaultForme, float genderRatio, - const char* growthRate, uint8_t captureRate, - uint8_t baseHappiness) { - auto cName = Arbutils::CaseInsensitiveConstString(name); - auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate); - return new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness); +export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name, + const PokemonForme* defaultForme, float genderRatio, + const char* growthRate, uint8_t captureRate, uint8_t baseHappiness) { + Try(auto cName = Arbutils::CaseInsensitiveConstString(name); + auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate); + out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);) } export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc0d57..beb21e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,10 +36,10 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) endif() if (NOT WINDOWS) execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated - -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION}) + -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:staticC=True) else() execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated - -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows) + -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:staticC=True) endif() endif () include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) @@ -97,13 +97,13 @@ if (WINDOWS) endif (WINDOWS) if (STATICC) + message(STATUS "Linking C library statically") SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++) if (NOT DEFINED CONAN_EXPORTED) SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++) endif() endif() - target_link_libraries(pkmnLib PUBLIC ${_LINKS}) if (NOT DEFINED CONAN_EXPORTED)