Create an instance of object from interface from C# DLL
Dec 28, 2012 at 3:09pm UTC
I am trying to run a function from a DLL file. That function is embedded in a series of interfaces. No classes. I can't run it in my C++/CLI. I am getting an unhandled exception.
This is how my code looks like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/ main project file.
#include "stdafx.h"
using namespace System;
using namespace AGP::Tools;
int main(array<System::String ^> ^args)
{
ITools ^tools = ToolsFactory::Load(0);
ITools3 ^engine = tools->Tools2->Engine;
engine->Run(1); // Run is a function
Console::WriteLine("\nOK" );
ToolsFactory::Unload(0);
Console::WriteLine(L"Press any key to continue . . ." );
return 0;
}
I am getting a error message like this:
unhandled exception: systemNullReferenceException: Object reference not set to an instance of an object at
AGP.Tools.Engine.Run(int 32)
Dec 28, 2012 at 4:13pm UTC
That DLL is a COM server ? If so, request a interface pointer via CoCreateInstance() API.
Topic archived. No new replies allowed.