I''ve read the tutorial suggested and null_pointers''s code sample. The code seems almost compilable. I have some problems with the Class I''l importing which I''m not sure are my of this new codes fault(simple due to the fact that I''ve never gotten this code to compile anyway).
Here are the problems:
1) warning C4273: ''CNULLRenderer::CNULLRenderer'' : inconsistent dll linkage. dllexport assumed.
This occurs on every function that has an implementation in the DLL file.
2) NULL Renderer.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) const CNULLRenderer::`vftable''" (__imp_??_7CNULLRenderer@@6B@)
Strangely however a similar message appears when I have no default constructor define in the base or derived class:
NULL Renderer.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CNULLRenderer::CNULLRenderer(void)" (__imp_??0CNULLRenderer@@QAE@XZ)
Following is some source that should be relevent:
////////////////////////////////////////Interface.h Defines a base class object for all objects created in DLL''sclass IInterface{};typedef IInterface* (* allocate_type)();typedef void (* deallocate_type)(IInterface*);////////////////////////////////////////Renderer.h This file is included in each renderer implementation DLLclass CRenderer : public IInterface{public:...}/////////////////////////////////////////NULLRenderer.h This is a DLL''s include file.#ifdef EXPORT#define EXPORT __declspec(dllexport)#else#define EXPORT __declspec(dllimport)#endif#pragma warning (disable:4275) //An exported class was derived from a class that was not exported.#include "Renderer.h"class EXPORT CNULLRenderer : public CRenderer{public: const bool Create(void); const bool Destroy(void);};extern "C" { IInterface* allocate() { return new CNULLRenderer; } void deallocate(IInterface* p) { delete p; }};///////////////////////////////////////Library.h This file wraps library loading \ class access. For simplicity each DLL will only have master 1 class derived from IInterfaceclass CLibrary{public: CLibrary(); ~CLibrary(); IInterface* Load(const char* a_LibraryName); void Unload(void);private: void* m_LibraryHandle; IInterface* m_InterfaceClass;};
If someone is willing to help and this is not enough information to go on I''m happy to mail the file, zipped they should only be a few K
Thanks
Chris