PlatformFunction and EsEntryPoint parameter/return type accuracy requirement changed
Reason for change
The new virtual machines introduced in V9.0 use a 3rd party library (libffi) to help implement the FFI (Foreign Function Interface) capability of VA Smalltalk. This is the low-level machinery that allows VA Smalltalk to make calls to other languages like C.
In previous versions of the product, all values were extended to 32-bits when being passed to, or returned from, an external language function (except 64-bit types which were passed as 64-bits).
As an example, consider the following C Function.
void doSomething(void *data)
The first parameter type of the associated PlatformFunction should be something like #pointer, since data is of type (void *). However, previous versions of VA Smalltalk would allow you to specify that type as #uint8, #uint16, #uint32. It wouldn't really matter (except 64-bit quantities) because it would just extend it to 32-bits anyways.
While its confusing when the binding type specification does not match the external function specification, the actual reason for this change is simply because this is not how libffi works. It expects a higher degree of type accuracy. The result of specifying #uint8 against the example above would be that the pointer gets truncated to an 8-bit quantity when preparing for the call to the C function.
Action required
Check your existing PlatformFunction and EsEntryPoint usages and ensure that the parameter and return types conform to what is specified by the external function declaration. Pay particular attention to the size of the types to ensure that truncation will not occur.
Last modified date: 07/01/2019