Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 18

Previous Page 17   Index   Next Page 19

Exception handling
Page 18 of 750
At time of publication only one flag is set at any one time. Future versions maybe set multiple
flags, e.g. E_SYNTAX_ERROR and E_WARNING.
Because of this, it is required to mask out the error type:
if (ErrType & E_SYNTAX_ERROR)
{
// some code
return 0; // continue processing
}
If the error callback function returns a value other than zero, processing stops immediately.
All callback functions must use the correct calling convention. The C definition above contains the
macro PDF_CALL that is defined as __stdcall under Windows. Note that a wrongly defined
calling convention causes an access violation!
When using DynaPDF with C or C++, you can change the calling convention to __fastcall or
__cdecl by changing the macro PDF_CALL in the main interface dynapdf.h and in the project
settings. However, standard call is strongly recommended. Note that the library must be
recompiled when changing the calling convention. Delphi, Visual Basic, and VB .Net require
standard call!
Exception handling in Visual Basic, Visual Basic .Net
The Visual Basic wrapper class CPDF uses events instead of callback functions to pass error
messages and warnings to the user; native language exceptions are not used.
The usage of the event functions is quite easy; just declare a local instance variable of the wrapper
class CPDF in the Option Explicit section of the unit as follows:
Private WithEvents FPDF As CPDF
The command above enables the event support of the class CPDF. The instance variable FPDF is
now listed in the left combo box of the VB code editor.
The right combo box contains the available events, when selecting the event "Error" VB adds
automatically an empty event procedure to your source code:
 

Previous topic: Exception handling in C, C++, C#, Delphi

Next topic: Special issues in Visual Basic and .Net