Start Back Next End
  
ZBasic Language Reference
132
ZBasic Microcontrollers
to access an external identifier that differs only in case from an existing ZBasic identifier.  One way to
resolve this type of problem (and identifier clashes generally) is to import the external identifiers into a
ZBasic namespace.  The downside of this solution is that the namespace prefix will need to be prepended
to all top-level imported identifiers when used in ZBasic code.  See section 3.27 describing namespaces
for more information on this topic.
The third important issue arises when imported names are not legal ZBasic identifiers.  This can arise, for
example, because C/C++ identifiers must begin with an alphabetic character or an underscore and
contain only alphabetic, numeric and underscore characters.  Normally, a ZBasic identifier has the same
form except that it may not begin with an underscore.  To successfully import identifiers beginning with an
underscore you must ensure that the ZBasic compiler is using the C name style (which is now the default
setting).
The final important issue is related to importing C++ classes.  Normally, during the compilation process
the ZBasic compiler produces C code that is equivalent to the ZBasic code it is not possible to access
C++ classes, namespaces and other features specific to C++ code in C code.  The solution to this is to
direct the ZBasic compiler to produce C++ code instead of C code thus allowing reference to the imported
C++ elements.  This can be accomplished using either the Option CodeType directive or the --code-
type command line option.
Previous page Top Next page