Look:
Code:
(1)
extern "C" _declspec(dllexport) int add(int a,int b)
{
return a+b;
}
int main()
{
printf("a+b=%d",add(2,6));
getchar();
return 0;
}
(2)
int main()
{
typedef int (*FUN)(int,int);
FUN fun;
HMODULE hmod=LoadLibrary("dllexe.exe");
if(NULL==hmod)
{
printf("error load\n");
return -1;
}
fun=(FUN)GetProcAddress(hmod,"add");
if(NULL==fun)
{
printf("error GetProcAddress\n");
return -1;
}
int sum=(*fun)(18,22);
printf("sum=%d\n",sum);
FreeLibrary(hmod);
getchar();
return 0;
}
The first process export a function,and when it is running,I want to know
how the second process load the first process?(Because they are both independent processes,and they have independent 4G virtual memory)