E
ewpatton
I'm working on a modular application that handles working with
different file types. Each file type is defined in a separate DLL so
that new types can be defined and then imported. Here's the code I've
been using:
namespace Workspace
{
public interface class IFileType {
public:
virtual String ^GetFileType();
};
}
This interface is shared among all DLL files. In each DLL there is
supposed to be a definition like:
namespace Workspace
{
public ref class FileType : public IFileType {
public:
virtual String ^GetFileType() { return ".txt"; }
}
}
This keeps everything structured so the program just has to enumerate
through a list of DLLs looking for DLLs with the class
Workspace.FileType. The program then loads these DLLs dynamically
along the lines of:
IFileType ^ft = reinterpret_cast<IFileType ^>
Activator::CreateInstance(Type::GetType("Workspace.FileType,
TextFile"));
which loads the DLL and initiates an instance of the FileType class.
However, when I attempt to use the class:
ft->GetFileType();
I get a System.EntryPointNotFoundException exception. How do I
properly cast the System::Object ^ back to a copy of my IFileType ^
class?
Evan
different file types. Each file type is defined in a separate DLL so
that new types can be defined and then imported. Here's the code I've
been using:
namespace Workspace
{
public interface class IFileType {
public:
virtual String ^GetFileType();
};
}
This interface is shared among all DLL files. In each DLL there is
supposed to be a definition like:
namespace Workspace
{
public ref class FileType : public IFileType {
public:
virtual String ^GetFileType() { return ".txt"; }
}
}
This keeps everything structured so the program just has to enumerate
through a list of DLLs looking for DLLs with the class
Workspace.FileType. The program then loads these DLLs dynamically
along the lines of:
IFileType ^ft = reinterpret_cast<IFileType ^>
Activator::CreateInstance(Type::GetType("Workspace.FileType,
TextFile"));
which loads the DLL and initiates an instance of the FileType class.
However, when I attempt to use the class:
ft->GetFileType();
I get a System.EntryPointNotFoundException exception. How do I
properly cast the System::Object ^ back to a copy of my IFileType ^
class?
Evan