title: Use C++ DLL callback function in a Delphi application
body: <p>I try to use C++ DLL function in my Delphi application. I've the problem in using call back function like that:</p>
  
  <p><strong>Exported functions definitions in C++:</strong></p>
  
  <pre><code>typedef void (__CDECL__* RegisterCallBacksFunction)(AudioChunkCallBackFunction, CaptureEventCallBackFunction, LogMngr*);
  </code></pre>
  
  <p><strong>Callback definitions:</strong></p>
  
  <pre><code>typedef void (__CDECL__*AudioChunkCallBackFunction)(AudioChunkRef, CStdString&amp; capturePort);
  typedef void (__CDECL__*CaptureEventCallBackFunction)(CaptureEventRef, CStdString&amp; capturePort);
  </code></pre>
  
  <p><strong>AudioChunkRef and CaptureEventRef :</strong></p>
  
  <pre><code>typedef boost::shared_ptr&lt;AudioChunk&gt; AudioChunkRef;
  typedef boost::shared_ptr&lt;CaptureEvent&gt; CaptureEventRef;
  </code></pre>
  
  <p><strong>And AudioChunk and CaptureEvent are C++ class:</strong></p>
  
  <pre><code>class __declspec( dllexport ) AudioChunk // or CaptureEvent (both are similar)
  {
  public:
  //some functions and variables
  private:
  //some functions and variables
  };
  </code></pre>
  
  <p><strong>C++ library exports:</strong></p>
  
  <pre><code>extern "C"
  {
  __declspec( dllexport ) void __CDECL__  RegisterCallBacks(AudioChunkCallBackFunction, CaptureEventCallBackFunction, LogMngr*);
  }
  </code></pre>
  
  <p>How can use RegisterCallBacks function in my Delphi app. ?</p>