Applies To:
  • CitectSCADA 5.x

Summary:
Question: I am trying to use the CTAPI interface with the Borland C compiler. However I keep getting the error " Fatal: Bad object file 'ctapi.lib' near file offset 0 ". What is causing this error?

Solution:
To get the CTAPI to talk with a Borland C executable you have to do the following:

1) Use the Borland utility IMPLIB to create a BC++ linkable library from the DLL (i.e. IMPLIB CTAPI.LIB CTAPI.DLL)

2) Modify the function entry point declarations in the header file a follows:

/************** ENTRY POINT DECLARATIONS ********************************/
HANDLE WINAPI ctOpen(LPCSTR,LPCSTR,LPCSTR,DWORD); /* Open CTAPI interface */
BOOL WINAPI ctClose(HANDLE); /* Close CTAPI interface */
DWORD WINAPI ctCicode(HANDLE,LPCSTR,DWORD,DWORD,LPSTR,DWORD,CTOVERLAPPED*); /* execute cicode */
BOOL WINAPI ctPointWrite(HANDLE,HANDLE,void*,DWORD,CTOVERLAPPED*); /* write to point handle */
BOOL WINAPI ctPointRead(HANDLE,HANDLE,void*,DWORD,CTOVERLAPPED*); /* read from point handle */
HANDLE WINAPI ctTagToPoint(HANDLE,LPCSTR,DWORD,CTOVERLAPPED*); /* convert tag into point handle*/
BOOL WINAPI ctPointClose(HANDLE,HANDLE); /* free a point handle */
BOOL WINAPI ctTagWrite(HANDLE,LPCSTR,LPCSTR); /* write to tag */
BOOL WINAPI ctTagRead(HANDLE,LPCSTR,LPSTR,DWORD); /* read from tag */
BOOL WINAPI ctEngToRaw(double*,double,CTSCALE*,DWORD); /* scale from eng to raw */
BOOL WINAPI ctRawToEng(double*,double,CTSCALE*,DWORD); /* scale from raw to eng */

 

Keywords:
 

Attachments