Skip to content
Snippets Groups Projects
Commit 6b7a4ace authored by Uwe Woessner's avatar Uwe Woessner
Browse files

c functions can't return C++ classes (at least not in MSVC)

parent 30bb2197
No related branches found
No related tags found
No related merge requests found
......@@ -20,14 +20,14 @@ extern "C" SPAWNPOINT_SHARED_EXPORT const std::string &OpenPASS_GetVersion()
return Version;
}
extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface* OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
const CallbackInterface* callbacks)
{
Callbacks = callbacks;
try
{
return std::make_unique<SpawnerPreRunCommon>(dependencies,
return new SpawnerPreRunCommon(dependencies,
callbacks);
}
catch(const std::runtime_error &ex)
......@@ -50,11 +50,11 @@ extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPAS
}
}
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface::Agents OpenPASS_Trigger(SpawnPointInterface *implementation, int time)
extern "C" SPAWNPOINT_SHARED_EXPORT void OpenPASS_Trigger(SpawnPointInterface *implementation, int time, SpawnPointInterface::Agents &agents)
{
try
{
return implementation->Trigger(time);
agents = implementation->Trigger(time);
}
catch(const std::runtime_error &ex)
{
......@@ -63,7 +63,7 @@ extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface::Agents OpenPASS_Trigger
Callbacks->Log(CbkLogLevel::Error, __FILE__, __LINE__, ex.what());
}
return {};
return;
}
catch(...)
{
......@@ -71,6 +71,6 @@ extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface::Agents OpenPASS_Trigger
{
Callbacks->Log(CbkLogLevel::Error, __FILE__, __LINE__, "unexpected exception");
}
return {};
return;
}
}
......@@ -24,14 +24,14 @@ extern "C" SPAWNPOINT_SHARED_EXPORT const std::string &OpenPASS_GetVersion()
return Version;
}
extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface* OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
const CallbackInterface* callbacks)
{
Callbacks = callbacks;
try
{
return std::make_unique<SpawnerRuntimeCommon>(dependencies,
return new SpawnerRuntimeCommon(dependencies,
callbacks);
}
catch(const std::runtime_error &ex)
......@@ -54,7 +54,7 @@ extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPAS
}
}
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface::Agents OpenPASS_Trigger(SpawnPointInterface* implementation, int time)
extern "C" SPAWNPOINT_SHARED_EXPORT void OpenPASS_Trigger(SpawnPointInterface *implementation, int time, SpawnPointInterface::Agents &agents)
{
return implementation->Trigger(time);
agents = implementation->Trigger(time);
}
......@@ -20,14 +20,14 @@ extern "C" SPAWNPOINT_SHARED_EXPORT const std::string &OpenPASS_GetVersion()
return Version;
}
extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface* OpenPASS_CreateInstance(const SpawnPointDependencies* dependencies,
const CallbackInterface* callbacks)
{
Callbacks = callbacks;
try
{
return std::make_unique<SpawnerScenario>(dependencies,
return new SpawnerScenario(dependencies,
callbacks);
}
catch(const std::runtime_error &ex)
......@@ -50,7 +50,7 @@ extern "C" SPAWNPOINT_SHARED_EXPORT std::unique_ptr<SpawnPointInterface> OpenPAS
}
}
extern "C" SPAWNPOINT_SHARED_EXPORT SpawnPointInterface::Agents OpenPASS_Trigger(SpawnPointInterface *implementation, int time)
extern "C" SPAWNPOINT_SHARED_EXPORT void OpenPASS_Trigger(SpawnPointInterface *implementation, int time, SpawnPointInterface::Agents &agents)
{
return implementation->Trigger(time);
agents = implementation->Trigger(time);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment