1) I'm using the Borland C++ verision
I go to FILE >> New >> OTHER and choose Dynamic Link Library
2 Files Pop Up. Project1 and Unit1.cpp
With the .cpp file I rename it as TestDLL.cpp, below is the following code:
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
void __stdcall SayHello(void)
{
PRINTF("Hello");
}
then I create a .h file called TestDll.h, code is the following
#ifndef MAIN_DLL_UNIT_H
#define MAIN_DLL_UNIT_H
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) void __stdcall SayHello(void);
#ifdef __cplusplus
};
#endif /* __cplusplus*/
#endif /* MAIN_DLL_UNIT_H */
Then I open a console application
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
#include <stdio.h>
#include <conio.h>
#include "MainDLLUnit.h"
int main(int argc, char* argv[])
{
SayHello();
getch();
return 0;
}
I get the following error "Unresvoled external 'SayHello' referecned..."
what am I doing wrong?