Object Toolkit C++ Spawn mode crashes
I am trying to create an app using Object Toolkit C++ and run it using spawn mode (exe). I have tried with DLL and it works, but when I compile to exe and change the creotk.dat file to startup spawn it does not work anymore. After having registered the app in auxiliary applications, pressing start causes Creo to freeze and then crash.
My additional dependencies in the Visual studio solution is :
- otk_cpp_md.lib
- otk_222_md.lib
- protkmd_NU.lib
My creotk.dat is as follows:
name ObjectTest
startup spawn
#toolkit object
#creo_type direct
exec_file C:\Users\SENY5612\source\repos\ObjectToolkitTest\x64\Debug\FindNumberAnnotate.exe
text_dir .\text
allow_stop true
delay_start false
end
My source code is as following (for now it is more or less empty as you can see):
#include <wfcSession.h>
#include <pfcGlobal.h>
#include <pfcCommand.h>
#include <pfcUI.h>
#include <pfcExceptions.h>
#include <wfcClient.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <stdexcept>
class OTKTestCallBack : public virtual pfcUICommandActionListener
{
public:
void OnCommand();
};
extern "C" int main(int argc, char* argv[])
{
return 0;
}
/* Entry */
extern "C" int user_initialize(
int argc,
char* argv[],
char* version,
char* build,
wchar_t errbuf[80])
{
pfcUICommand_ptr command;
try
{
return (wfcTK_NO_ERROR);
}
xcatchbegin
xcatchcip(Ex)
return (wfcTK_NO_ERROR);
xcatchend
return 0;
}
/* Exit*/
extern "C" void user_terminate()
{
}
void OTKTestCallBack::OnCommand()
{
try
{
}
xcatchbegin
xcatchcip(Ex)
xcatchend
catch (...)
{
}
}

