#include "stdafx.h" #include "windows.h" #include "conio.h" #include "windef.h" int _tmain(int argc, _TCHAR* argv[]) { HINSTANCE instcall=LoadLibrary(TEXT("c:\\test2.dll")); if(instcall==NULL) printf("Failed to load dll"); FARPROC getproc=GetProcAddress(instcall,"funcall"); if(getproc==NULL) printf("failed entry point"); typedef int(__stdcall * picFunc)(); picFunc funcall; funcall=picFunc(getproc); funcall(); getch(); //LPTSTR path=(LPTSTR)"c:\test2.dll"; /*system("notepad.exe"); DWORD threadId=dwThredId*/ /*typedef void *(_stdcall *creatfn)(); creatfn myfunc=(creatfn) GetProcAddress(instcall,"call"); void *objptr=myfunc();*/ /*picFunc funcall;*/ //=picFunc(getproc); //funcall(); ///call=mycall(getproc); }
// test2.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" #include "stdio.h" #include "conio.h" void funcall() { printf("hello"); }
GetProcAddress
main()
extern C {...}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)