Hi,
Check this.
When you say that you are not using import lib, I assume that you are not generating it. So there is not need to use __declspec(dllexport) to export a function, rather you can use a def file:
DefFile.def
================
LIBRARY "MyDLL"
EXPORTS
DisplayHelloFromDLL
================
Now coming to accessing this. All we have to do is to map that "MyDLL" into our exe address space. For this we can use using 'LoadLibrary'. Check this:
#include <windows.h>
typedef void ( WINAPIV* LPFN_DISPLAYHELLO ) ( );
void main()
{
HINSTANCE hMyDLL = LoadLibraryA("Dll_New.dll");
LPFN_DISPLAYHELLO fnDisplayName = (LPFN_DISPLAYHELLO)GetProcAddress(
hMyDLL,
"DisplayHelloFromDLL" );
fnDisplayName();
FreeLibrary( hMyDLL );
}