Hello!
I have to write a synchrone application for PTC Pro/ENGINEER Wildfire 4.0 using Visual Studio 2005.
Pro/TOOLKIT is an API in native C/C++.
The DLL is loaded as plugin into Pro/ENGINEER.
It is not possible to compile that Project in CLR (I think, an tried)
Now I tried a Win32 DLL, use the CLR Switch and linked the DLL static to my dll.
Linking works but on a call to a managed function, Pro/ENGINEER crashes.
Is there a solution for such a problem?
Thanks for help!
Lars
The Managed Test Class
namespace WpfProject { public class StartClass { public static void Start() { String test = "This is a test"; MessageBox.Show(test); } } }
The DLL
#ifdef MANAGEDBRIDGEDLL_EXPORTS #define MANAGEDBRIDGEDLL_API __declspec(dllexport) #else #define MANAGEDBRIDGEDLL_API __declspec(dllimport) #endif // Diese Klasse wird aus ManagedBridgeDll.dll exportiert. class MANAGEDBRIDGEDLL_API CManagedBridgeDll { public: CManagedBridgeDll(void); ~CManagedBridgeDll(); void StartDlg(void); }; CManagedBridgeDll::CManagedBridgeDll() { } CManagedBridgeDll::~CManagedBridgeDll() { } void CManagedBridgeDll::StartDlg(void) { WpfProject::StartClass::Start(); }
The call from the plugin
#include <ManagedBridgeDll.h> int MtkCmdTestFunction(uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data) { try { CManagedBridgeDll *umc = new CManagedBridgeDll(); umc->StartDlg(); delete umc; } catch (std::exception& e) { WRITE_EXCEPTION_TO_PROE(e); } return 0; }