Once Again on Deployment

Mikael Kindborg mikael.kindborg at gmail.com
Thu Jul 13 09:49:50 UTC 2006


Hi,

We are developing a software product for children we call "Magic
Words" and these are our experiences from experimenting with a
deployment version for WIndows.

We have found it useful to use a tiny laucher exe.

The problem we have had with the approach that Bert describes in the
page referred to below is that it takes quite a while for the
application to launch. We tried different variations for the ImageFile
parameter in the ini-file, but even when using the full pathname it
takes 15 seconds on my machine to start the app. (The parameters I
refer to are on this page, which is already pointed to by Bert's
message: http://minnow.cc.gatech.edu/squeak/3274)

As I recall, this problem have been discussed previously on the list,
and is related to how the virtual machine searches for image files at
startup and some quirks with a Windows API call involved in this. Hot
having investigated the detail about this (perhaps it can be fixed),
we wrote a tiny C program that simply starts Squeak with the image
file that contains our app as an argument. Using this method the app
launches in < 1 second.

Here is the source for the launcher app:

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

void LaunchSqueak(void);

int PASCAL WinMain( HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline,
                    int cmdshow )
{
    //MSG         msg;

    /* shut up warning */
    previnst = previnst;
    cmdline = cmdline;

    LaunchSqueak();

    return(0);

} /* WinMain */


void LaunchSqueak()
{
    BOOL success;
    LPSTARTUPINFO sinfo;
    LPPROCESS_INFORMATION pinfo;
    LPSTR dir;
    LPSTR wdir;
    LPSTR command;

    // Startup info - no settings are used.

    sinfo = malloc (sizeof(STARTUPINFO));
    sinfo->cb = sizeof(STARTUPINFO);
    sinfo->lpReserved = (LPTSTR) NULL;
    sinfo->lpDesktop = (LPTSTR) NULL;
    sinfo->lpTitle = (LPTSTR) NULL;
    sinfo->dwX = (DWORD) NULL;
    sinfo->dwY = (DWORD) NULL;
    sinfo->dwXSize = (DWORD) NULL;
    sinfo->dwYSize = (DWORD) NULL;
    sinfo->dwXCountChars = (DWORD) NULL;
    sinfo->dwYCountChars = (DWORD) NULL;
    sinfo->dwFillAttribute = (DWORD) NULL;
    sinfo->dwFlags = (DWORD) NULL;
    sinfo->wShowWindow = 0;
    sinfo->cbReserved2 = 0;
    sinfo->lpReserved2 = NULL;
    sinfo->hStdInput = (HANDLE) NULL;
    sinfo->hStdOutput = (HANDLE) NULL;
    sinfo->hStdError = (HANDLE) NULL;

    // Returned process info - not used.

    pinfo = malloc(sizeof(PROCESS_INFORMATION));

    // Get current directory.

    dir = malloc(1000);
    GetCurrentDirectory(1000, dir);

    // Set working directory.

    wdir = malloc(1000);
    strcpy(wdir, dir);
    strcat(wdir, "\\Data");

    // Set command string.

    command = malloc(1000);
    strcpy(command, dir);
    strcat(command, "\\Data\\Squeak.exe App.image");
    //strcpy(command, dir);
    //strcat(command, "\\Data\\App.image");

    // Create the Squeak process.

    success = CreateProcess
        (
        NULL,           //LPCTSTR lpApplicationName,
        command,        //LPTSTR lpCommandLine,
        NULL,           //LPSECURITY_ATTRIBUTES lpProcessAttributes,
        NULL,           //LPSECURITY_ATTRIBUTES lpThreadAttributes,
        FALSE,          //BOOL bInheritHandles,
        (DWORD) NULL,   //DWORD dwCreationFlags,    ??
CREATE_NO_WINDOW use this flag? Appernetly not needed.
        NULL,           //LPVOID lpEnvironment,
        wdir,           //LPCTSTR lpCurrentDirectory,
        sinfo,          //LPSTARTUPINFO lpStartupInfo,
        pinfo           //LPPROCESS_INFORMATION lpProcessInformation
        );

    success = success;  // You can remove this, it was just to get a
place for a breakpoint for debugging.
}

We simply hardcoded the name of the application image and the
directory it is placed in. A bit ugly but seems to work. The following
is the directory layout:

AppDir (name of your program's directory)
  App.exe (name of the app's exe-file)
  Data
    App.image
    Squeak.exe (and related files you need)

We built this using the Open Watcom compiler.

Tried some of the ini options mention on http://minnow.cc.gatech.edu/squeak/3274
and WindowTitle works fine, but the options related to the Quit dialog
box did not work. The dialog always shows, with the standard text.
Here is the ini-file I used for testing, perhaps I got something
wrong:

[Global]
DeferUpdate=1
ShowConsole=0
DynamicConsole=1
ReduceCPUUsage=1
ReduceCPUInBackground=1
3ButtonMouse=0
1ButtonMouse=0
UseDirectSound=0
PriorityBoost=1
B3DXUsesOpenGL=0
CaseSensitiveFileMode=0
WindowTitle="Magic Words"
ImageFile="C:\Documents and
Settings\Mikael\Skrivbord\MagicWords\MagicWordsDev.image"
EnableAltF4Quit=0
QuitDialogMessage="Do you want to quit Magic Words?"
QuitDialogLabel="Magic Words"

To sum up, I think the deployment method we have used works very well,
and with a good installer installation is smooth. It is also easy to
put the program in a zip file and deploy it that way, or make a CD
with auto start.

I guess Mac and Linux also could use a simple start script to launch
Squeak with the desired image.

Regarding making a single exe, that would be nice for small
applications, but as Bert writes in this message, most programs need
additional files and various directories for application data etc.

Best regards, Micke

On 7/13/06, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> Have a look at what Bert wrote recently in
>
> -
> http://www.mail-archive.com/beginners@lists.squeakfoundation.org/msg00330.html
>
> /Klaus
>
> On Thu, 13 Jul 2006 09:25:49 +0200, Dan Shafer wrote:
>
> > Can someone give me or point me to a succinct status update on the
> > current state of the ability to convert a Squeak image into a standalone
> > application for WIndows, OSX and Linux? I know we can always deliver an
> > image and a VM without sources and effectively create the appearance of
> > a standalone but those suckers are huge, so my client is asking if the
> > prospects for being able to deliver stripped-down and double-clickable
> > apps is in the offing or in the distance.
> >
> > Thanks.
> > Dan
> >
> >
> >
>
>
>
>



More information about the Squeak-dev mailing list