Two methods of parameter passing are supported: the standard method and parameter passing using the Standard-C stdarg mechanism [6]. The second method supports an arbitrary number of arguments to be passed to C++ method. Figure 7 shows the two supported parameter-passing methods and examples. Figure 8 shows the implementation details of the required interfacing functions to support these two types of parameter passing.
To aid users in extracting arbitrary number of arguments from the
va_list
structure (through the use of Standard-C
va_start
, va_arg
and va_end
macros), a supporting
C++ class called objc_t
and its corresponding “>>
”
overloaded output stream operator have been implemented and stored in
the in the supporting file ObjCsupport.h
. An example of the
usage is shown in Figure 7 in the user C++ implementation of
the sumN_x1
member method (in this case, to sum a list of three
real numbers).
Figure 9 shows the algorithm used to translate a C++ function
prototype to its Objective-C equivalent. The translation of the C++
function argument string to Objective-C equivalent is defined in the
writeobjc
action in the Classdesc's Objective-C base action definition
file writeobjc_base.h
.
To support the use of C++ only member-methods in the user model,
following member functions will not be translated to its
Objective-C equivalent: argument-list contains any C++ objects (such
as vector) or function-name that contain “cpp_
” prefix.