I have some general purpose functions defines in my exe file like Log(char* str). This function takes a string as an input from the caller and writes it to the logfile defined for that application. Now I want to write DLL code which will include a function to upload a file to a server.
The objective is to import the upload function from the DLL into the exe and use it. However, if any error is encountered, then the upload function must call the Log(char* str) function to write the error into the log file.
The trouble is that this DLL needs to be used in multiple applications and each app will have a different logfile at a different location. I want to write the DLL in such a way that it calls the corresponding Log(char* str) defined in the application. Similarly I have some other functions that are application-specific and cannot be included in the DLL beforehand.
How can I write such DLL code where it only knows the function prototype, but not the function definition, which resides inside the exe?
Log(char const* str), surely?