On Fri, Jan 4, 2013 at 12:37 AM, Igor Stasenko <siguctua@gmail.com> wrote:
On 4 January 2013 08:54, Torsten Bergmann <astares@gmx.de> wrote:
When one deploys an image one usually requires ONLY the image - not the source or changes file. An "image locker" code would look like this:
SmalltalkImage checkSourcesFileAvailability: false. SmalltalkImage checkChangesFileAvailability: false
do disable acording warnings when source/changefile is removed.
If one uses NativeBoost in such a deployment scenario, for instance the
NBWin32Shell shellBrowse: 'http://www.google.de'
functionality the internal code (due to missing source) now looks like this
shellExecute: t1 file: t2 parameters: t3 directory: t4 show: t5 <primitive: 'primitiveNativeCall' module: 'NativeBoostPlugin'> ^ self nbCall: #(#HINSTANCE #ShellExecuteA #(0 #, #LPCTSTR #lpOperation #, #LPCTSTR #lpFile #, #LPCTSTR #lpParameters #, #LPCTSTR #lpDirectory #, #INT #nShowCmd ) ) module: 'Shell32.dll'
Hence the t1 ... t5 parameters.
NativeBoost is in this situation not able to match the FFI parameters and throws an error "Could not find accessor for variable ..."
Try yourself without a changes and source file. This makes NativeBoost not very deployment friendly and unusable in such a "minimal deployment" scenario ...
Any comments?
yes it needs sources (indirectly) to bind method's argument names during code generation. To avoid that, i can imagine that one must modify a compiler to detect if compiled method primitive requires arg names, and store them in method properties. Like that later code generator can use them without need to access the source code.
Indeed. If a pragma were used then the whole thing could look a lot nicer, not be dependent on source, and include support for an error code. e.g. shellExecute: lpOperation file: lpFile parameters: lpParameters directory: lpDirectory show: nShowCmd <nbCall: #(#HINSTANCE #ShellExecuteA #(0 #, #LPCTSTR #lpOperation #, #LPCTSTR #lpFile #, #LPCTSTR #lpParameters #, #LPCTSTR #lpDirectory #, #INT #nShowCmd ) ) module: 'Shell32.dll' errorCode: ec> ^self nbCallFailedWith: ec It's pretty trivial to add such pragma compilers to the compiler. There is an example for the FFI. It also frees one to use a nicer syntax, e.g. shellExecute: lpOperation file: lpFile parameters: lpParameters directory: lpDirectory show: nShowCmd <nbCall: 'HINSTANCE ShellExecuteA(0, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd)' module: 'Shell32.dll' errorCode: ec> ^self nbCallFailedWith: ec
Thanks T.
-- Best regards, Igor Stasenko
-- best, Eliot