ooc  1.3c
Object Oriented tollkit fo ANSI C
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Notes on the MPLAB C18 port

The main issue with the MPLAB C18 compiler and development toolchain is that it lacks the dynamic memory handling (malloc() and others).

Due to this limitations you can not use the ooc_new() and similar functions for creating your Objects. Instead you must allocate your Objects statically and populate them with the ooc_use() and similar constructors. The same applies for the deletion of an Object: you can not delete it, just ooc_release(), wich destruct the Object properly, but does not free the memory location since it was allocated statically.

Exception handling works fine. Since exception_new() returns a statically pre-allocated Exception object, it is available in this port too, so feel free to use exception_new(), it is no problem.

The ooc libraries support only the Large data / Large code model! Always compile your project with these settings ("-mL" compiler otion)!
The following compiler controls are defined for MPLAB C18:

  • ROM
  • GEN_PTR
  • NO_RELATIVE_INCLUDE
  • OOC_NO_THREADS
  • NO_INLINE
  • OOC_NO_DYNAMIC_MEM
  • OOC_NO_FINALIZE
  • _OOC_VTAB_INITIALIZER

The following classes are proted to the MPLAB C18:

Class Comment
ooc.h No dynamic memory handling
exception.h
refcounted.h
vector.h No dynamic memroy handling. Use vector_use_with_store() to allocate a Vector.
list.h No dynamic memroy handling. As a consequence, List can hold only Objects the are subclasses of ListNode! Use list_use_of_nodes() to allocate a List.
testcase.h No dynamic memroy handling.

The ooc/signal.h class is not ported to the MPLAB C18 platform, since it uses dynamic memory handling internally.

Since the MPLAB C18 compiler is available on Windows only, this port is distributed in the Windows installer package only.

Note
There is a silly bug in the MPLAB C18 compiler: if you define the members of two classes in sequence, then the typedef for the first object struct is forgotten by the compiler. :-( You must typedef it again by yourself, but this would hurt other compilers.
The workaround is:
DeclareClass( First, Base );
DeclareClass( Second, Base )
#ifdef __18CXX
typedef struct FirstObject * First;
#endif
The libraries are built with the Lite version of the MPLAB C18 compiler, so they are not optimized! For real live projects build your own ooc libraries with optimization (with the Enterprise or Pro editions)!