Tags

, , ,

Csta library is supplied by many vendors to be used in Tsapi applications. In this specific case, library provided from Alcatel will be used, which includes some Alcatel specific extensions. However, building it in a c++ program is a bit difficult. Googling reveals cases of same problem, but there is not an explicit solution given, so here is the way I followed to succeed, in case someone else also has to deal with.

First start with minimum by following documentation TsapiPremium.pdf of Alcatel. Let’s call CSTAInitialize() and CSTACleanup(). In fact, these functions are somehow called default in Windows and are not obligatory, but they are simple enough to do their demonstration purpose in this context; to obtain a successful build.

alcatel tsapi - alcatel tsapi documentation

Following the suggestions of documentation an initial round would be;

alcatel tsapi - initial cpp file

alcatel tsapi - initial make file

with following directory structure;

alcatel tsapi - directory structue

Unfortunately, build will be broken;

alcatel tsapi - initial build failure

The problematic part is about declaration of TSAPI;

alcatel tsapi - problem

Here we see that TSAPI is defined as using the pascal calling convention with returning a RetCode_t, which turns to be type int. What I expect is __stdcall that is some kind of a standard for Win32 DLLs, therefore I redefine pascal to __stdcall

alcatel tsapi - initial redefine pascal file

We have still a few deficiencies;

alcatel tsapi - mid build failure

Unknown type HWND may be searched through msdn website, where it is suggested to use WinDef.h. A better alternative is use of windows.h which also contains some of dependencies that WinDef.h will require.

alcatel tsapi - msdn hwnd solution

Although TsapiPremium document suggests checking ACSPOSITIVE for return value of CSTAInitialize() and CSTACleanup(), it is not found in definitions. Closest alternative is use of ACSPOSITIVE_ACK which also defaults to zero.

Final notch will be Level 1 warning about anachronism usage. variable type TSAPI which resolves to int __stdcall does not have a meaning and modifier on data which is __stdcall is ignored. Solution will simply be change of TSAPI with int. Resulting template will be;

alcatel tsapi - final cpp file

Advertisements