[Previous] [Next] [Contents] [Index]
This chapter provides information on compiling and linking PC-DCE programs. It contains the following sections:
2.2 Exception Handling
2.3 Using OLE 2.0 with PC-DCE
2.4 Generating Stubs from the IDL Command Line
2.5 Using the Microsoft IDE Interface
2.1 Linking and Compiling PC-DCE Applications
When you compile your PC-DCE programs, be sure to use the following compile switches:
The DCE API is exported via dce32.dll, so you must link your applications with dce32.lib.
If you do not want to link with the DLL version of the C runtime library, be careful when freeing memory returned by DCE API calls and RPCs. Use rpc_sm_client_free() to free this memory.
2.1.1 Using Non-Microsoft Compilers
Visit our Technical Support web page for PC-DCE at http://support.entegrity.com for more detailed instructions on using this library.
2.2 Exception Handling
PC-DCE provides support for exception handling that conforms to OSF DCE threads specification.
NOTE:
PC-DCE exception handling is not the same as exception handling
provided by Visual C++ and the native WIN32 support for structured
exception handling. For a discussion of how to use DCE exception handling,
refer to the OSF DCE Application Development Guide.
2.2.1 Global Unwinding
The exception handler provided by the C++ language provides global unwinding. In global unwinding, when an exception occurs, the exception handler calls the destructors for all objects on the stack between where the exception is raised and where it is caught. If you are accustomed to C++ exception handling, you should be aware that DCE exceptions do not provide a similar feature.
2.2.2 DCE Exception Handler Definitions for C++
C++ and DCE both define certain keywords, such as TRY, for exception handling. To avoid conflict in PC-DCE programs written in C++, Entegrity® has renamed the DCE macros using the prefix DCE_ as shown in Table 2-1.
Be aware that the DCE and C++ exception handlers are not compatible.
2.2.3 Runtime Library Requirement
The PC-DCE exception handler implementation uses setjmp() and longjmp() calls. If your application uses PC-DCE exception handling, the runtime library that you link to your application must provide a setjmp() and longjmp() implementation compatible with the Microsoft Visual C++ runtime. This includes the size and semantics of the jump buffer allocated for these calls.
2.2.4 Mapping WIN32 Exceptions to DCE Threads Exceptions
As a side effect of this mapping, these exceptions are no longer propagated up via WIN32 structured exception handling to be handled by an external debugger. Non-production environments and environments that do not care about this mapping can disable this feature by calling the function __exc_w32_to_dce_map_set with an argument of 0 (false). This function, exported from dce32.dll and defined in dce/exc_handling.h, disables the mapping for the current process. You must call this function before executing any code block that uses PC-DCE exception handling.
2.3 Using OLE 2.0 with PC-DCE
If you need to use OLE and DCE in your application, make sure you do the following:
prompt> idl -no_mepv -v -cc_opt "-nologo -I. -DWIN32_LEAN_AND_MEAN \
-DWIN32 -D_MT -D_DLL"
2.5 Using the Microsoft IDE Interface
To use the Microsoft IDE interface with PC-DCE applications:
WIN32_LEAN_AND_MEAN
_MT
_DLL
[Previous] [Next] [Contents] [Index]
To make comments or ask for help, contact support@entegrity.com.