-
July 25th, 2013, 09:56 AM
#1
How to call a C function (in the host process) from a DLL
Hi all
I have a main program that loads a dll and calls functions inside dll. Everything is fine.
Now I would like to call a function belonging to the main exe from the dll. I didi this:
main.c:
__declspec(dllexport) void HelloWorld(void)
{
printf("The function was called by dll! \n");
}
On dll, .cpp file, on top:
__declspec(dllimport) void HelloWorld(void);
On a dll method which is called from EXE I call:
int DLL_EXPORT Finalize(void)
{
exitCondition=0;
printf("Thread was killed\n");
HelloWorld();
return 0;
}
but compiler says:
...\main.cpp|59|undefined reference to `_imp___Z8HelloWorldv'|
How to solve this?
Thanks a lot
Alex
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|