[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[jscocoa] 001 C and ObjC calls, missing bindings

Code

"ObjectiveC MISSING constant resolution"
| value aName |
aName := #MissingConstantForTesting.
value := Smalltalk nativeObjectAt: aName ifAbsent: [].
value isNil ifTrue: [ self error: 'Missing Constant ' ,aName ].
self print: aName ,'=' ,value.
Smalltalk gc.


"External(C) MISSING functions resolution & evaluation"
| value |
value := # #MissingFunctionForTesting.
value isNumber ifFalse: [ self error: #mustBeNumber ].
self print: 'Result=',value.
Smalltalk gc.


References

IMPORTANT
Ensure that you have defined the required constants and functions for testing in the ".bridgesupport" file.
 self cancelFileIn"
 the following definitions are samples to edit
 your default.bridgetsupport file"!

    <!- definitions added to test accessing undefined bindings >
    <constant name='MissingConstantForTesting' declared_type='NSString*' type='^{__CFString=}' const='true'/>
    <function name='MissingFunctionForTesting'> <retval type='d' /> </function>