BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

An unhandled exception was encountered during a user callbac

Anonymous
Not applicable
Hello

I call dll functions from my ac add-on.
Archicad crashs end of the code!

I get the following error
'Unhandled exception at 0x00007ff8eacc6a20 in ArchiCAD.exe: 0xC000041D: An unhandled exception was encountered during a user callback'

and here is my code
 if (e.GetSource() == &m_btnTest) {
		
		typedef IKlass* (__cdecl *iklass_factory)();

		HINSTANCE dll_handle = ::LoadLibrary(TEXT("BCWebSDK.dll"));
		if (!dll_handle) {
		}

		// Get the function from the DLL
		iklass_factory factory_func = reinterpret_cast<iklass_factory>(::GetProcAddress(dll_handle, "create_klass"));
		if (!factory_func) {
			::FreeLibrary(dll_handle);
		}

		IKlass* instance = factory_func();
		std::vector<int> info = instance->data(); //  This is what I need from dll and it works fine
		instance->destroy();
		::FreeLibrary(dll_handle);

	}

I get data which I need but end of the code archicad crashs
The same code works in other projects so error occurs only when I try to run my code in archicad add-on
and mouse pointer goes to GSNew.hpp file on delete function

Thanks in advance!
1 REPLY 1
BrunoValads
Contributor

Hi! Were you able to fix this error? I'm getting the same exception when using libcpr (DLLss are in Archicad.exe folder, and LIBs are properly linked at "Aditional Dependencies").

Learn and get certified!