Forum Discussion

Amparo's avatar
Amparo
New Contributor
7 years ago

visual 2010 settings for testing a C dll

Hi, 

I am writing a C dll with Visual 2010 and I am not able to test it with TestComplete

 

The simplest function of this library is "increment" that only returns the input parameter plus 1:


#ifndef mylib_h__
#define mylib_h__

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _WINDOWS
#ifdef  CALLBACKLIBRARY_EXPORTS
#define DLLDIR __declspec (dllexport)
#else
#define DLLDIR __declspec (dllimport)
#endif
#else
#define DLLDIR
#endif


int DLLDIR __stdcall increment(int x);

#ifdef __cplusplus
}
#endif


#endif

 

In TestComplete, we define a JScript with this code:

 

function TestSimply()
{
  var def_DLL,ret;
 
  // Defines the dll type
  def_DLL = DLL["DefineDLL"]("callbacklibrary");
  def_DLL["DefineProc"]("increment", vt_int, vt_int);
 
  // Loads the dll.
  Lib = DLL["Load"]("C:\\Tests\\callbacklibrary.dll");  
      
    //Call the function from the library
    ret = Lib["increment"](10);    
 
}

 

When we run the test, TestComplete shows this error:

"object doesn't support this property or method"

We do not know if it is a bad configuration of Visual or defining test in TestComplete

Could you help me, please?

Thanks in advance

 

Amparo

 

 

 

 

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Do you know what line the error occurs on?  The error you indicated means that, in the code you're calling, you are attempting to call or access a method or property of an object that doesn't support it... so, somewhere in your code, you haven't established the object properly. 

     

     

    • Amparo's avatar
      Amparo
      New Contributor

      Thank you for your reply

      We got to call this method of the C library and execute it but now we have another error when leave the method:

      "An exception occurred: 0xC0000005; class: ; description"

      (Note:We have TestComplete version 9)

       

      Amparo