title: How to call a function defined in my exe inside my DLL?
body: <p>I have some general purpose functions defines in my exe file like <code>Log(char* str)</code>. 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. </p>
  
  <p>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 <code>Log(char* str)</code> function to write the error into the log file.</p>
  
  <p>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 <code>Log(char* str)</code> defined in the application. Similarly I have some other functions that are application-specific and cannot be included in the DLL beforehand. </p>
  
  <p>How can I write such DLL code where it only knows the function prototype, but not the function definition, which resides inside the exe?</p>