There's a difference between plain DLL's and .NET assemblies (which can be through DLL's). Add Reference makes a reference to a .NET assembly. Chances are you're working with a plain DLL.
The DLL should have a header that your executable build uses (which prototype functions exported from the DLL), and an import library (aspell.lib?) that your executable build links against. You specify this under Project Properties->Linker->Input->Additional Dependencies.
Brian
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::~CopyPtr<class acommon::DocumentChecker>(void)" (__imp_?1?$CopyPtr@VDocumentChecker@acommon@@@acommon@@QAE@XZ) referenced in function __unwindfunclet$?0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z$0
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::CopyPtr<class acommon::DocumentChecker>(class acommon::DocumentChecker *)" (__imp_?0?$CopyPtr@VDocumentChecker@acommon@@@acommon@@QAE@PAVDocumentChecker@1@@Z) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" (?0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: class acommon::DocumentChecker * __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::operator->(void)const " (__imp_?C?$CopyPtr@VDocumentChecker@acommon@@@acommon@@QBEPAVDocumentChecker@1@XZ) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" (?0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::reset(class acommon::DocumentChecker *)" (__imp_?reset@?$CopyPtr@VDocumentChecker@acommon@@@acommon@@QAEXPAVDocumentChecker@2@@Z) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" (?0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)Not sure if this helps explain what is happening better
You class methods need to be exported from the dll. I would read up on the topic:
The usual way class definitions are exported is to prepend "class Foo" with __declspec(dllexport). Since this header is used by both the build of the DLL and the client code, a macro is introduced that evaluates to either __declspec(dllexport) or empty (or __declspec(dllimport), but that's a more advanced topic).
To see this, use the Win32 DLL wizard in Visual Studio to create a DLL project from scratch: the wizard sets this up for you. Maybe aspell is doing this already, but the macro needed to enable __declspec(dllexport) is not being defined in the build of aspell.
Brian
however i now get the errors come up when i compile the project:
c:\Documents and Settings\Shaun\Desktop\aspell-win32\prog\checker_string.cpp(16): error C2761: 'bool CheckerString::next_misspelling(void)' : member function redeclaration not allowed
c:\Documents and Settings\Shaun\Desktop\aspell-win32\prog\checker_string.cpp(15): error C2761: 'void CheckerString::replace(acommon::ParmString)' : member function redeclaration not allowed
im guessing this is because there is no main method where they are used but are declared as their own methods further down the code. p.s. i have tried adding them in different parts of the class but there is no change.
Just put __declspec(dllexport) before "class" and every method will be exported. (I have said this.)
Make sure you really are using the right version of the lib (the one you just built).
Go to the Visual Studio 2005 Command Prompt (under Tools), find your DLL, and type:
dumpbin -exports aspell.dll
This should verify that your methods are being exported.
Brian
aspellcmd fatal error LNK1141: failure during build of exports file
aspellcmd fatal error LNK1149: output filename matches input filename 'c:\Documents and Settings\Shaun\Desktop\aspell-win32\Debug\aspell.lib'
which i have found confusing because as far as i know i need the aspell.lib file included in the project.
You're making settings in an attempt to fix the problem that are causing other problems. The MSDN docs for LNK1149 makes it pretty clear on what the solution is.
Fix the LNK1149 and see if the problem goes away.
To be sure you're on track, ASPELL.LIB is not "included" like header files are. They are added to the linker settings. (Project Properties->Linker->Input->Additional Dependencies.)
Brian