10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PDF_TRY(p){/* ... */if (error_condition){PDF_EXIT_TRY(p);return -1;}}PDF_CATCH(p){/* error cleanup */PDF_RETHROW(p);}Memory Management in C. In order to allow for maximum flexibility, PDFlib’s internalmemory management routines (which are based on standard C malloc/free) can bereplaced by external procedures provided by the client. These procedures will be calledfor all PDFlib-internal memory allocation or deallocation. Memory management routinescan be installed with a call to PDF_new2( ), and will be used in lieu of PDFlib’s internalroutines. Either all or none of the following routines must be supplied:> an allocation routine> a deallocation (free) routine> a reallocation routine for enlarging memory blocks previously allocated with the allocationroutine.The memory routines must adhere to the standard C malloc/free/realloc semantics, butmay choose an arbitrary implementation. All routines will be supplied with a pointer tothe calling PDFlib object. The only exception to this rule is that the very first call to theallocation routine will supply a PDF pointer of NULL. Client-provided memory allocationroutines must therefore be prepared to deal with a NULL PDF pointer.Using the PDF_get_opaque( ) function, an opaque application specific pointer can beretrieved from the PDFlib object. The opaque pointer itself is supplied by the client inthe PDF_new2( ) call. The opaque pointer is useful for multi-threaded applications whichmay want to keep a pointer to thread- or class specific data inside the PDFlib object, foruse in memory management or error handling.Unicode in the C Language Binding. Clients of the C language binding must take carenot to use the standard text output functions (PDF_show( ), PDF_show_xy( ), and PDF_continue_text( )) when the text may contain embedded null characters. In such cases thealternate functions PDF_show2( ) etc. must be used, and the length of the string must besupplied separately. This is not a concern for all other language bindings since thePDFlib language wrappers internally call PDF_show2( ) etc. in the first place.2.3 C Binding 29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!