Your header file mydll.h
appears to be missing the declaration of myfunction
. Correct that omission and your code will compile.
On top of that you will need to ensure that:
- The .lib import library that was created when you compiled the DLL is passed to the linker when you link your C++ program.
- The DLL can be found when you attempt to run your program. That is best achieved by placing the DLL in the same directory as the executable.
I would also comment that I would expect to see the extern "C"
in the header file rather than forcing every single user of the header file to write extern "C"
. The header file really should stand alone.