BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Programming   |   Topic List   |   Previous   |   Next   |   Contents

   Programming a BEA Tuxedo Application Using TxRPC

Building a Windows Workstation RPC Client

Compilation of the client stub for Windows is similar to the DOS compilation, but requires the -D_TM_WIN definition as a compilation option. This ensures that the correct function prototypes for the TxRPC and BEA Tuxedo system runtime functions are used. While the client stub source is the same, it must be compiled specially to handle the fact that the text and data segments for the DLL will be different from the code calling it. The header file and stub are automatically generated to allow for the declarations to be changed easily, using C pre-processor definitions. The definition _TMF (for "far") appears before all pointers in the header file and _TMF is automatically defined as "_far" if _TM_WIN is defined.

In most cases, using standard libraries, the buildclt(1) command can be used to link the client. The library to be used is wtrpc.lib. A Sample Application, shows a case where buildclt cannot be used because non-standard (QuickWin) libraries are being used.

The sample also shows how to create a Dynamic Link Library (DLL) using the client stub. This usage will be very popular when used with a visual application builder that requires DLL use (where the application code cannot be statically linked in). Windows functions are traditionally declared to have the _pascal calling convention. The header file and stub are automatically generated to allow for the declarations to be changed easily, using C pre-processor definitions. _TMX (for "eXport") appears before all declared functions. By default, this definition is defined to nothing. When compiling a stub for inclusion in a DLL, _TMX should be defined to _far _pascal. Also, the files to be included in the DLL must be compiled with the large memory model. Because using _pascal automatically converts the function names to upper case in the library, it is a good idea to run with the -port case option turned on, which does additional validation to see if two declared names differ only in case.

A complete example of building a Windows DLL is shown in A Sample Application.

Note: A compilation error may occur if a TxRPC client includes windows.h, due to a duplicate uuid_t definition. It will be necessary for the application to either not include windows.h (because it is included already) or to include it within a different file in the application.