July 25th, 2013, 09:56 AM
How to call a C function (in the host process) from a DLL
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:
__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)
printf("Thread was killed\n");
but compiler says:
...\main.cpp|59|undefined reference to `_imp___Z8HelloWorldv'|
How to solve this?
Thanks a lot
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.