Managed Wrapper Entry Point Problems

Managed Wrapper Entry Point Problems

tech
Enthusiast Enthusiast
818 Views
1 Reply
Message 1 of 2

Managed Wrapper Entry Point Problems

tech
Enthusiast
Enthusiast

After upgrading my application to use the ObjectArx 2021 libraries,  my .net wrapper classes for my custom entities are no longer working. It is as if the acrxEntryPoint is being completely ignored. I have the following code in my c++/cli .net wrapper project:

#include "stdafx.h"
#include <gcroot.h>
#include <vcclr.h>
#include "mgdinterop.h"
#include "rxregsvc.h"
#include "includes.h"

#define szRDS _RXST("Adsk")

... Usings left out for brevity
/// ------------------------------------------------------------------------
static AcMgObjectFactoryBase** g_PEs = nullptr;
static void* g_moduleHandle = nullptr;

void InitModule()
{
	// Maps the entities to the .net Wrappers.
	static AcMgObjectFactoryBase* PEs[] =
	{
		new AcMgObjectFactory<TPG_ObjectMgd, TPG_Object>(),
		new AcMgObjectFactory<TPG_ProjectMgd, TPG_Project>(),
		....
		nullptr
	};
	g_PEs = PEs;
}

class ManagedArxApplication : public AcRxArxApp
{
public:
	ManagedArxApplication() : AcRxArxApp() {}
	virtual AcRx::AppRetCode On_kInitAppMsg(void* pkt)
	{
		AcRx::AppRetCode retCode = AcRxDbxApp::On_kInitAppMsg(pkt);
		InitModule();
		return (retCode);
	}

	virtual AcRx::AppRetCode On_kUnloadAppMsg(void* pkt)
	{
		int i = 0;
		while (g_PEs[i] != NULL)
			delete g_PEs[i++];

		AcRx::AppRetCode retCode = AcRxDbxApp::On_kUnloadAppMsg(pkt);

		return (retCode);
	}
	virtual void RegisterServerComponents()
	{}
};

IMPLEMENT_ARX_ENTRYPOINT(ManagedArxApplication);

 

 

In my .net application, I have implemented the IExtensionApplication interface and in the Initialize() method I have the following two lines of code which I would expect to invoke the entry point for the managed wrappers:

 

RXClass rxc = TPG_ProjectMgd.GetClass(typeof(TPG_ProjectMgd));
                Application.ShowAlertDialog(rxc.Name);

 

I can break at the above code, but placing a breakpoint On_kInitAppMsg(...) in the previous code block is never hit. This all works in my 2019 project. Any ideas?

 

Mike

 

 

 

 

 

 

 

 

 

0 Likes
Accepted solutions (1)
819 Views
1 Reply
Reply (1)
Message 2 of 2

tech
Enthusiast
Enthusiast
Accepted solution

Found the issue. One of the include directory paths for Debug/x64 configuration was still pointing to the previous ObjectArx inc/lib paths. Everything is working as expected now. If you have a similar problem, check all your includes directories for all build configurations. 🙂

 

Mike

0 Likes