MediaWiki:Blockip

From askoh.net wiki

Jump to: navigation, search

Documentation of Visual Studio build of SqueakVM 4.0. If you want to play with it immediately, get it here. Otherwise, follow instruction below to build a VS SqueakVM 4.0.

  • Note: in case rebuild cause any error, follow step 1 of subtitle: Squeak, include directories


Contents

Build

  • Download SqueakVM-Win32-4.0.2-bin and SqueakVM-Win32-4.0.2-src. Extract SqueakVM-Win32-4.0.2-src into root directory, eg. "C:\Smalltalk\Squeak\4.0\demo" in my case. This will be root directory for source code, VS projects and also the solution file. You will get "MyRoot\platforms" and "MyRoot\winbuild", which in my case "C:\Smalltalk\Squeak\4.0\demo\platforms".
  • Download Squeak 4.1 image.
  • Open-up Visual Studio (VC 2008 Express), choose Empty Project, create new project named Squeak4.0. Set location to "MyRoot\Projects", in my case "C:\Smalltalk\Squeak\4.0\demo\Projects". Uncheck Create directory for solution.
  • Close the solution. Cut Squeak4.0.sln and Squeak4.0.ncb from "MyRoot\Projects\Squeak4.0", and paste it at "MyRoot".
  • Open up Squeak4.0.sln, ignore pop-up warnings. Right-click on Squeak4.0(unavailable), remove it. At File -> Add -> Existing Projects..., go into "MyRoot\Projects\Squeak4.0" and add Squeak4.0.vcproj.
  • Steps above needed to achieve directory-tree of desire.


Squeak

  • Under Tools -> Options -> Projects and Solutions -> VC++ Directories, make sure to select Include files at Show directories for:, then add in the following:
    • $(SolutionDir)\winbuild\src\vm
    • $(SolutionDir)\platforms\win32\build\vm
    • $(SolutionDir)\platforms\win32\vm
    • $(SolutionDir)\platforms\Cross\vm
  • Right-click on Squeak4.0, choose Add -> Existing Item.... Repeat this step, add these files to the project.
    • "MyRoot\winbuild\src\vm" :
      • interp.h
      • sqNamedPrims.h
      • interp.c
    • "MyRoot\platforms\Cross\vm" :
      • sq.h
      • sqNamedPrims.c
      • sqVirtualMachine.c
    • "MyRoot\platforms\win32\vm" :
      • sqConfig.h
      • sqWin32.h
      • sqWin32Prefs.h
      • version.h
      • sqWin32Alloc.c
      • sqWin32Args.c
      • sqWin32Directory.c
      • sqWin32Exports.c
      • sqWin32ExternalPrims.c
      • sqWin32Intel.c
      • sqWin32PluginSupport.c
      • sqWin32Prefs.c
      • sqWin32Service.c
      • sqWin32Stubs.c
      • sqWin32Utils.c
      • sqWin32Window.c
      • version.c
    • "MyRoot\platforms\win32\misc" : (Add to Resource File)
      • Squeak.rc
      • resource.h
  • Under Configuration Properties -> General, set Character Set to Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_WINDOWS;__i386__;_CRT_SECURE_NO_DEPRECATE;_MSC_VER;_USE_32BIT_TIME_T.
  • Under C/C++ -> Code Generation -> Basic Runtime Checks, choose Default.
  • Under C/C++ -> Code Generation -> Runtime Library, choose Multi-threaded Debug (/MTd).
  • Under C/C++ -> Browse Information -> Enable Browse Information, choose Include All Browse Information (/FR).
  • Under C/C++ -> Advanced -> Show Includes, choose Yes (/showIncludes).
  • Under C/C++ -> Advanced -> Undefine Preprocessor Definitions, fill in UNICODE.
  • Under Linker -> General -> Enable Incremental Linking, choose Yes (/INCREMENTAL).
  • Under Linker -> Input -> Additional Dependencies, fill in winmm.lib msvcrtd.lib Version.lib.
  • Under Linker -> Input -> Ignore All Default Libraries, choose Yes (/NODEFAULTLIB).
  • Under Linker -> System -> SubSystem, choose Windows (/SUBSYSTEM:WINDOWS).
  • Under Linker -> Advanced-> Randomized Base Address, choose Disable Image Randomization (/DYNAMICBASE:NO).
  • Under Linker -> Advanced-> Data Execution Prevention (DEP), choose Default.
  • Click on Apply, then OK.
  • Some adjustment to the coding.
    • Open version.h, change content to #define VM_BUILD_STRING "Win32 built on " __DATE__ " "__TIME__ " Compiler: Visual Studio 2008"
  • sqMemoryAccess.h line 166, delete
static void inline flag(char *ignored)
{
  (void)ignored;
}

replace it with #define flag() ;

  • sqWin32Window.c line 39, add the line void HideSplashScreen(void);
  • sqWin32Window.c line 525, comment out the entire line. //__asm__ __volatile__ ("rdtsc" : "=A" (value));.
  • sqWin32Window.c line 534, change void SetDefaultPrinter() to void SetDefaultPrinterSqueak().
  • sqWin32Window.c line 2879, replace ofn.lpstrTitle = L""VM_NAME": Please select an image file..."; with ofn.lpstrTitle = TEXT(VM_NAME": Please select an image file...");.
  • sqWin32Prefs.c line 362, change SetDefaultPrinter(); to SetDefaultPrinterSqueak();.
  • sqWin32Intel.c line 332-353, comment out these lines.
  • sqWin32Intel.c line 191, change printf to _printf. We'll ignore it.
  • sqWin32Intel.c line 204, change fprintf to _fprintf. We'll ignore it.
  • sqWin32.h line227-228, add these lines#define VM_NAME "Squeak" #define VM_VERSION "SqueakDLL"
  • sq.h line 447-448, add these lines. #define strdup _strdup, #define strnicmp _strnicmp and #define warnPrintf printf

B2DPlugin

  • Create a new empty project named B2DPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked B2DPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\B2DPlugin" : B2DPlugin.c
  • Open B2DPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check B2DPlugin.

BitBltPlugin

  • Create a new empty project named BitBltPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked BitBltPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\BitBltPlugin" : BitBltPlugin.c
  • Open BitBltPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check BitBltPlugin.



BMPReadWriterPlugin

  • Create a new empty project named BMPReadWriterPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked BMPReadWriterPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\BMPReadWriterPlugin" : BMPReadWriterPlugin.c
  • Open BMPReadWriterPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check BMPReadWriterPlugin.



FilePlugin

  • Create a new empty project named FilePlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked FilePlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\FilePlugin" : FilePlugin.c
  • "MyRoot\platforms\Cross\plugins\FilePlugin" : FilePlugin.h sqFilePluginBasicPrims.c
  • "MyRoot\platforms\win32\plugins\FilePlugin" : sqWin32FilePrims.c
  • Open FilePlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\FilePlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check FilePlugin.


DropPlugin

  • Create a new empty project named DropPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked DropPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\DropPlugin" : DropPlugin.c
  • "MyRoot\platforms\Cross\plugins\DropPlugin" : DropPlugin.h
  • "MyRoot\platforms\win32\plugins\DropPlugin" : sqWin32Drop.c
  • Open DropPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\DropPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check DropPlugin.


HostWindowPlugin

  • Create a new empty project named HostWindowPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked HostWindowPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\HostWindowPlugin" : HostWindowPlugin.c
  • "MyRoot\platforms\Cross\plugins\HostWindowPlugin" : HostWindowPlugin.h
  • "MyRoot\platforms\win32\plugins\HostWindowPlugin" : sqWin32HostWindowPlugin.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\HostWindowPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check HostWindowPlugin.


SecurityPlugin

  • Create a new empty project named SecurityPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked SecurityPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\SecurityPlugin" : SecurityPlugin.c
  • "MyRoot\platforms\Cross\plugins\SecurityPlugin" : SecurityPlugin.h
  • "MyRoot\platforms\win32\plugins\SecurityPlugin" : sqWin32Security.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\SecurityPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • sqWin32Security.c, line 17, static HRESULT __stdcall (*shGetFolderPath)(HWND, int, HANDLE, DWORD, WCHAR*);, delete __stdcall.
  • Right-click Squeak, choose Project Dependencies..., check SecurityPlugin.

SocketPlugin

  • Create a new empty project named SocketPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked SocketPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\SocketPlugin" : SocketPlugin.c
  • "MyRoot\platforms\Cross\plugins\SocketPlugin" : SocketPlugin.h
  • "MyRoot\platforms\win32\plugins\SocketPlugin" : sqWin32NewNet.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\SocketPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Under Librarian -> General -> Additional Dependencies, choose Ws2_32.lib.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check SocketPlugin.


JoystickTabletPlugin

  • Create a new empty project named JoystickTabletPlugin. Fill in Location: as "MyRoot\VS2008\Projects". Under Solution:, choose add to solution. Right-clicked JoystickTabletPlugin, choose Add -> Existing Item....
  • "MyRoot\winbuild\src\JoystickTabletPlugin" : JoystickTabletPlugin.c
  • "MyRoot\platforms\Cross\plugins\JoystickTabletPlugin" : JoystickTabletPlugin.h
  • "MyRoot\platforms\win32\plugins\JoystickTabletPlugin" : sqWin32Joystick.c
  • Open HostWindowPlugin Property Pages.
  • Under Configuration Properties -> General -> Configuration Type, choose Static Library (.lib).
  • Under Configuration Properties -> General -> Character Set, choose Use Unicode Character Set.
  • Under C/C++ -> General -> Additional Include Directories, fill in "$(SolutionDir)\platforms\Cross\plugins\JoystickTabletPlugin".
  • Under C/C++ -> Preprocessor -> Preprocessor Definition, fill in WIN32;_DEBUG;_LIB;SQUEAK_BUILTIN_PLUGIN.
  • Click on Apply, then OK.
  • Right-click Squeak, choose Project Dependencies..., check JoystickTabletPlugin.

Finally..

  • Modify sqNamedPrims.h as follows.
/* This is an automatically generated table of all builtin modules in the VM */

extern sqExport vm_exports[];
extern sqExport os_exports[];
extern sqExport BMPReadWriterPlugin_exports[];
extern sqExport B2DPlugin_exports[];
extern sqExport BitBltPlugin_exports[];
extern sqExport DropPlugin_exports[];
extern sqExport FilePlugin_exports[];
extern sqExport HostWindowPlugin_exports[];
extern sqExport JoystickTabletPlugin_exports[];
extern sqExport SecurityPlugin_exports[];
extern sqExport SocketPlugin_exports[];

sqExport *pluginExports[] = {
	vm_exports,
	os_exports,
	BMPReadWriterPlugin_exports,
	B2DPlugin_exports,
	BitBltPlugin_exports,
	DropPlugin_exports,
	FilePlugin_exports,
	HostWindowPlugin_exports,
	JoystickTabletPlugin_exports,
	SecurityPlugin_exports,
	SocketPlugin_exports,
	NULL
};

Directory Tree

Note

  1. Make sure to copy splash.bmp into "MyRoot\Projects\Squeak4.0", so that during debug, Squeak can find it, and open-up Squeak window. Without it, Squeak window wouldn't show up. splash.bmp can be found in Squeak package, along side with image and Squeak executable.
  2. Extract Squeak 4.1-image.zip into "MyRoot\Projects\Squeak4.0".
Personal tools
Navigation