title: Using a dll in C++ code
body: <p>I want to use pjsipDll.dll in a c++ code. I got this dll from one of the sites, I only know how to build the code to obtain the dll file. So I did that and now I've the pjsipDll.dll file with me. I want to use certain functions in the DLL in my code(C++)</p>
  
  <p>I tried the following code. &lt;&lt; I haven't made/added any dll or .h file to the project, there is only the following CPP file>></p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int CallMyDLL(void)
  {
      /* get handle to dll */
     HINSTANCE hGetProcIDDLL = LoadLibrary("G:\\July\\9.0\\pjsipdll\\Lib\\pjsipDll.dll");
  
     /* get pointer to the function in the dll*/
     FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"dll_makeCall");
  
     /*
        Define the Function in the DLL for reuse. This is just prototyping the dll's function.
        A mock of it. Use "stdcall" for maximum compatibility.
     */
     typedef int (__stdcall * pICFUNC)(int, char *);
  
     pICFUNC MyFunction;
     MyFunction = pICFUNC(lpfnGetProcessID);
  
     /* The actual call to the function contained in the dll */
     int intMyReturnVal = MyFunction(5,"hello");
  
     /* Release the Dll */
     FreeLibrary(hGetProcIDDLL);
  
     /* The return val from the dll */
  returnintMyReturnVal;
  } 
  void main()
  {
      cout&lt;&lt;"Hello World";
  
      CallMyDLL();
      getchar();
  }
  </code></pre>
  
  <p>I learnt this way from some site, to use the function from a DLL.</p>
  
  <p>The problem is, I get an ERROR:</p>
  
  <blockquote>
    <p>error C2065: 'HINSTANCE' : undeclared identifier   g:\july\9.0\pjproject-0.9.0\myproject\importerprojet\importerprojet\mycpp.cpp   9   importerProjet</p>
  </blockquote>
  
  <p>Can anyone help me out with this. Or atleast point me to the post if this query is already addressed. </p>
  
  <p>Thanks for your help,
  Vinu.</p>