ok i've been up all night + morning thinking about the problem and i think i've tried everything, and still i cant get it to work
ill post the code, maybe someone knows about this problem.
note: some changes have been done from previous posts.
the dll.h
Code:
#ifndef DLLKOD_H
#define DLLKOD_H
#define DllExport extern "C" __declspec (dllexport)
#include "windows.h"
HHOOK hok;
extern "C" LRESULT CALLBACK Proc(int,WPARAM,LPARAM);
#endif
the dll.cpp
Code:
#include "dllkod.h"
LRESULT CALLBACK __stdcall Proc(int code,WPARAM wParam,LPARAM lParam)
{
return CallNextHookEx(hok,code,wParam,lParam);
}
the program cpp shorted down for you
Code:
#include <iostream.h>
#include <windows.h>
int main()
{
static HINSTANCE hi;
HOOKPROC hProc;
hi = LoadLibrary("podedll.dll");
if(hi==0)
cout<<"could not load dll";
hProc=(HOOKPROC)GetProcAddress(hi,"_Proc@12");
if(hProc==0)
cout<<"could not load hook function";
return 0;
}
and the def file
Code:
LIBRARY "podedll.dll"
EXPORTS
Proc
if the def looks like that without the "_" before and "@12" after
i get the error
Code:
pode.def : error LNK2001: unresolved external symbol Proc
Debug/mainprog.lib : fatal error LNK1120: 1 unresolved externals
LINK : fatal error LNK1141: failure during build of exports file
Error executing link.exe.
mainprog.exe - 3 error(s), 0 warning(s)
else i get
Code:
mainprog.exp : warning LNK4070: /OUT:podedll.dll directive in .EXP differs from output filename "Debug/mainprog.exe"; ignoring directive
Debug/mainprog.exe : warning LNK4086: entrypoint "_mainCRTStartup" is not __stdcall with 12 bytes of arguments; image may not run
mainprog.exp : error LNK2001: unresolved external symbol _Proc@12
Debug/mainprog.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
mainprog.exe - 2 error(s), 2 warning(s)
thx!
//edit
maybe i havent linked it properly!?