Once an EsEntryPoint is created, send it the message address to bind it. The address can be passed to an external language function that requires a function pointer. For example, to get the address of the WindowProc callback described above:
address := windowProc address.
External functions calling Smalltalk using EsEntryPoint must run in the same thread as Smalltalk.
The call to address can fail and cause a walkback for the following reasons:
When the address of an EsEntryPoint is called by the external language, there is always the possibility of failure. It may not be possible to allocate the necessary objects required for the conversion to Smalltalk objects. The return value from Smalltalk may be invalid and unconvertable.
EsEntryPoint instances contain a fail address that defaults to 0. When the callback fails for any reason, this address is checked. If it is 0, 0 is returned from the callback. If it is not 0, it must be the address of a function that has exactly the same prototype as the EsEntryPoint. Upon failure, this function is called.
For example, in Windows, the following code can be used to catch a WindowProc failure:
windowProc failAddress: (PlatformFunctions at: 'DefWindowProc') address
This code causes DefWindowProc to be called when the Smalltalk WindowProc fails. When an EsEntryPoint unbinds, the fail address is reset to 0.