-- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu
Few NB-FFI methods will work without sources, as many rely on the automatic argument name -> signature mapping. This happens the first time a method is called after startup, and platform-specific recompilation occurs. When the argument names are decompiled as arg1, arg2, the mapping will fail. (Other NB methods that generate machine code without using NB-FFI, will still work though)
Theoretically, one could solve this by internalizing the source of all NB-FFI calling method in the method trailer* at the end of deployment preparation process. (so no NB methods have a chance to trigger before image save) NB puts native code into the same trailer space, and combing different method trailer types is currently unsupported (AFAIK), but the transition TrailerWithEmbeddedSource** -> TrailerWithNBCode should happen only once.
Yes it would be good to have a method for doing that. https://pharo.fogbugz.com/default.asp?14311
Cheers, Henry
* something along the lines of: | nativeMethods | nativeMethods := (Pragma allInstances select: [ :each | each arguments = #(#primitiveNativeCall #NativeBoostPlugin) ]) collect: #method.
nativeMethods do: [ :nativeMethod | nativeMethod methodClass methodDict at: nativeMethod selector put: (nativeMethod copyWithTrailerBytes: (CompiledMethodTrailer new sourceCode: nativeMethod sourceCode))]
** TrailerWithEmbeddedTemps would probably be sufficient, but other than a reserved type, I can't see there's working code for it