Troubles Calling a DLL

This is a discussion on Troubles Calling a DLL within the C++ Programming forums, part of the General Programming Boards category; I need to call an external dll. Here are the basic instructions that came with the external dll: Code: BIOWDLL.DLL ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    Troubles Calling a DLL

    I need to call an external dll. Here are the basic instructions
    that came with the external dll:
    Code:
                   BIOWDLL.DLL  Information
               -------------------------------------
    
    __declspec ( dllexport )int WINAPI GetSrcBIOWIN (PSTR cSmilePass,
       PSTR cChemical, PSTR EstLin, PSTR EstNon, PSTR EstUlt, PSTR EstPrim,
       PSTR UltTime, PSTR PrimTime, PSTR EstMitiLin, PSTR EstMitiNon,
       PSTR DetailResults, PSTR numLines, PSTR ErrorMess)
    
    
    Arguments with the same names as the KOWDLL.DLL are exactly the same.
    
           This function returns:   0  for no errors
                                   -1  for if a SMILES error occurs
    
    NOTE ... this function receives three variables from the calling
       function:
    
       (1) cSmilePass - the SMILES notation
    
       (2) cChemical - the user chemical name or identifier
    
      Other argument variables:
    
       (3) EstLin - estimated Linear Model biodegradation probability
                     (probability of biodegrading fast or not)
    I'm trying to create a function that calls a function from biowwin.dll. My program passes the cSmilesPass parameter to the function, in this case it passes"C[N+]C(C)(C)".Here's my code:
    Code:
    int CallBIOWDLL(void)
    { 
         /* get handle to dll */
         HINSTANCE hGetProcIDDLL = LoadLibrary("C:\WINDOWS\system32\BIOWDLL.dll");
    
         /* get pointer to the function in the dll*/
         FARPROC lpfnGetProcessID = GetProcAddress(HMODULE(hGetProcIDDLL), "GetSrcBIOWIN");
    
         /* 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)(char*);
    
         pICFUNC MyFunction;
         MyFunction = pICFUNC(lpfnGetProcessID);
    
         /* The actual call to the function contained in the dll */ 
         int intMyReturnVal = MyFunction("C[N+]C(C)(C)");
    
         /* Release the Dll */
         FreeLibrary(hGetProcIDDLL);
    
         /* The return val from the dll */
         return intMyReturnVal;
    }
    I'm using Visual C++ 4.0. When I try to compile, I get the following warnings and errors:
    Code:
    Compiling...
    request.cpp
    C:\MSDEV\Projects\cfx_biowwin\request.cpp(14) : warning C4129: 'W' : unrecognized character escape sequence
    C:\MSDEV\Projects\cfx_biowwin\request.cpp(14) : warning C4129: 's' : unrecognized character escape sequence
    C:\MSDEV\Projects\cfx_biowwin\request.cpp(14) : warning C4129: 'B' : unrecognized character escape sequence
    Linking...
    cfx_biowwin.dll - 0 error(s), 3 warning(s)
    I'm not sure about the unrecognized character escape sequence warnings. Any insight would be greatly appreciated.
    Last edited by jamez05; 12-02-2005 at 10:19 AM.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    use "\\" in paths
    Code:
     HINSTANCE hGetProcIDDLL = LoadLibrary("C:\\WINDOWS\\system32\\BIOWDLL.dll");

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    80
    Thanks for your help, that solved the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Calling Question
    By mercury529 in forum Windows Programming
    Replies: 11
    Last Post: 01-09-2007, 05:15 PM
  2. problem in calling DLL
    By bhagwat_maimt in forum C++ Programming
    Replies: 2
    Last Post: 11-19-2006, 09:43 PM
  3. Calling a DLL
    By jamez05 in forum C++ Programming
    Replies: 1
    Last Post: 01-05-2006, 10:13 AM
  4. Calling a VB DLL w/ forms from C++ DLL
    By UW_COOP in forum C++ Programming
    Replies: 8
    Last Post: 06-30-2003, 08:04 AM
  5. Function Calling From A DLL In a DLL
    By (TNT) in forum Windows Programming
    Replies: 1
    Last Post: 06-03-2002, 08:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21