As the title says, although I guess what I really mean is "And using them later."
The Setup
I have followed this answer:
https://stackoverflow.com/a/13219631/696407
which creates a very simple dll
#include <stdio.h>
extern "C"
{
__declspec(dllexport) void DisplayHelloFromMyDLL()
{
printf ("Hello DLL.\n");
}
}
and I now have a dll compiled for release:
- DllTest.dll
- DllTest.exp
- DllTest.lib
- DllTest.pdb
When I run DllTest.dll through dumpbin, I find this line:
1 0 00001000 DisplayHelloFromMyDLL = _DisplayHelloFromMyDLL
USING THE DLL
To use that function in a new solution, I believe I must
- Start a project in a new solution
- Add the location of the DLL to the project under
- Properties
- Configuration Properties
- Linker
- General
- Additional Library Directories
- General
- Linker
- Configuration Properties
- Properties
- Add the .lib file under
- Properties
- Configuration Properties
- Linker
- Input
- Additional Dependencies
- Input
- Linker
- Configuration Properties
- Properties
and, having added the .lib there, the next step is... hvæt?
My code right now:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
while(1)
{
DisplayHelloFromMyDLL();
}
return 0;
}
but that doesn't work.
EDIT: I guess "doesn't work" is vague. The function gets Error: identifier "DisplayHelloFromMyDLL" is undefined
(Side question: Is my function called DisplayHelloFromMyDLL();
or _DisplayHelloFromMyDLL();
?)