The Sourceforge downloads page for the older Subversion repository contains a Windows “msi” installer file for 64-bit Windows systems. Installing this will create a directory C:\objecticon\
containing a binary distribution.
To uninstall, just go to the Windows 10 settings dialog, select “Apps & features”, and find the entry for “objecticon”. Click on it and press “Uninstall”. This will remove the C:\objecticon\
directory.
It is not necessary to remove an old version before upgrading to a newer one; this is done automatically.
The version number of the installed package is formed from the subversion version number. For example subversion version 12345 would be package version “1.23.45.0”.
The C:\objecticon
directory contains a batch file, paths.bat
which can be run to setup the various environment variables needed by the translator. It also adds C:\objecticon\bin
to the PATH
.
It is not necessary to set any path or other environment variables before running a translated Object Icon program, because the path to the runtime interperter oix
is embedded into the executable output by the translator.
When outputting UTF-8 to the console (for example when writing a ucs
string), the console’s code page should be set with the following command :-
chcp 65001
Unfortunately I haven’t found a way to read UTF-8 input from the console. Unicode characters appear as null (ascii 0) characters when read.
The string literal escape sequence “\N” can be used to produce a platform-independent line ending. On Windows, this sequence expands to “\r\n”, and on other platforms to just “\n”.
oix
is built as a Windows console application. This means that Windows will create a console window for oix
unless it is started from an existing console. This can be annoying; starting an Object Icon program via a desktop icon will open an unwanted console window. However, this behaviour can be mitigated by setting the environment variable OI_HIDE_CONSOLE
to 1, before starting a particular program. This will make oix
hide the console window when it starts up. Thus hidden, the console window will still exist, but it won’t appear in the taskbar, the “alt-tab” switcher, and so on.
Obviously it is not desirable to do this in the general case, so OI_HIDE_CONSOLE
should not be set outside of an individual batch file or command line to launch a program from the desktop. A batch file might look like this :-
set OI_HIDE_CONSOLE=1
someprog.exe
This batch file sets the variable, and runs the (Object Icon) program someprog.exe
, which in turn runs oix
. The console window will then be hidden, and will thus appear to the user only instantaneously.
A call
command to another batch file, to set up variables such as OI_FONT
, OI_FONT_SIZE
and so on could also be made before someprog
is started.
An alternative to using a batch file is to create a shortcut to the desired Object Icon program, and place that on the desktop. Then, edit that shortcut and change the “Target” field to something like :-
C:\Windows\System32\cmd.exe /c "set ^"OI_HIDE_CONSOLE=1^" && <program>"
where <program>
is original value of “Target”; ie the path to the program to run. Note that the use of quotes, and escaped inner quotes (^“) is important. Without the latter, the value of OI_HIDE_CONSOLE
would include a space after the “1”, and would thus be invalid. Also, <program>
would need to be surrounded by escaped quotes if it contained spaces.
Like the batch file, a call
command to set variables could be inserted before the program is started.
It is tempting to configure the shortcut to use a minimized window (the “Run” field). However, this gives poor results and leads to the Object Icon program’s window starting minimized itself, behind other windows, or without the keyboard focus.
Wherever possible, the wide-character versions of the Win32 API are used, with conversions to and from UTF-8 (used internally by the ucs
type).
ieval
should work acceptably in the Windows console, but the program’s built-in line editing will be disabled. However, the console’s own line editing can of course be used instead. Alternatively, the graphics version of ieval
(option -g
) can be used.
The binary distribution includes the ssl
library (in lib/native
). This DLL is statically linked to the OpenSSL libraries.
To be useful, OpenSSL needs to have access to a set of root authority certificates. This enables the identity of remote hosts to be verified. A helpful page containing up-to-date certificates extracted from Mozilla is https://curl.haxx.se/docs/caextract.html. The certificates are contained in a single “.pem” file. After saving this file, OpenSSL can be directed to use it by setting the environment variable “SSL_CERT_FILE” to the location of the file.
This section describes how to compile Object Icon on Windows (32 and 64 bit).
Cygwin must be installed. It is used to provide make
and some other shell utilities. gcc
is not required however, since the Microsoft Visual C/C++ compiler is used. The compiled executables don’t rely on Cygwin in any way, and can be used from a Windows command prompt window if desired (a paths.bat
file is provided to set the usual environment variables).
The C/C++ compiler of Visual Studio 2015 or later must be used. It is not necessary to install Visual Studio itself; rather just the build tools alone are sufficient. These are a free download :-
https://visualstudio.microsoft.com/visual-cpp-build-tools/
The compiler executable, cl
, must be on the cygwin shell’s PATH
. Both 32 and 64 bit versions of the compiler are supported. To see which version is on the path, just type cl
at the bash prompt. For 32 bits the output might be :-
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
whilst for the 64 bit version :-
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Apart from PATH
, the enviroment variables INCLUDE
, LIB
and LIBPATH
need to be set correctly for the compiler to work from the command line. To find the correct settings, open a command prompt window, and run the vcvarsall.bat
batch file, as described in the following page :-
https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx
After running the batch file, the correct environment variable settings can be noted and placed in .bash_profile
. Example settings are, for 32 bits :-
PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 14.0/VC/bin:/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 14.0/Common7/IDE:/cygdrive/c/Program\ Files/Debugging\ Tools\ for\ Windows\ \(x64\):$PATH
export INCLUDE='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;'
export LIB='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\lib\um\x86;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86;'
export LIBPATH='C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB;References\CommonConfiguration\Neutral;\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;'
and for 64 bits :-
PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 14.0/VC/bin/amd64:/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 14.0/Common7/IDE:/cygdrive/c/Program\ Files/Debugging\ Tools\ for\ Windows\ \(x64\):$PATH
export INCLUDE='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;'
export LIB='C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\lib\um\x64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64;'
export LIBPATH='C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64;References\CommonConfiguration\Neutral;\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;'
Use the following command to checkout a read-only copy of the source code :-
svn co svn://svn.code.sf.net/p/objecticon/code/trunk objecticon
This will create a directory objecticon
under the present directory (you can change the last parameter to create a different directory name if you want).
Extract the source code from the .tar.gz file with a command like
tar xfz objecticon-1234.tar.gz
This will create a directory objecticon-1234
under the current directory. The number is the subversion version number from which the .tar.gz was built, and will of course be different. You can rename this directory if you like, but it must not be renamed (or moved) after configuration and compilation.
Microsoft’s vcpkg
(see https://github.com/microsoft/vcpkg) can be used to provide the external libraries for zlib, OpenSSL and MySQL. zlib
is just used to provide the -Z
option to oit
, whilst OpenSSL and MySQL provide the ssl
and mysql
libraries (in lib/native
).
After installation of vcpkg
, use one or more of the following commands to install the desired libraries (for a 64-bit build) :-
vcpkg install openssl:x64-windows-static
vcpkg install libmysql:x64-windows-static
vcpkg install zlib:x64-windows-static
The shared library versions can be installed instead (the same commands, but without the -static
ending). In this case, the appropriate vcpkg
bin
directory must be on the executable PATH variable, so that the third-party DLLs can be located as needed.
After ensuring that the cl
compiler is available, change to the new directory and run the following command at the bash prompt :-
./configure-win32 [OPTIONS]
This is the equivalent of running the ./configure
script on a Unix system. Afterwards, make
can be run to compile everything, and make test
will run the tests. The script accepts the following options :-
-r
- compile with “release” compiler options, rather than the usual “debug” options.-v DIR
- specify the vcpkg directory from which to take include/library files for the s
, q
and z
options.-s
- use the OpenSSL library.-q
- use the MySQL library.-z
- use the Zlib library.-D
- use dynamic rather than static linking to the C runtime library (compiler option /MD
rather than the usual /MT
).Note that the -D
option should only be used with the dynamic library versions of the vcpkg
libraries; conversely, without -D
, only the static versions should be used. Also, -D
necessitates the correct PATH
setting. The examples below clarify these points.
Compile with a statically linked runtime, and make use of ssl and zlib libraries :-
./configure-win32 -v "C:\vcpkg\installed\x64-windows-static" -sz
The resulting oix.exe
is about 2.2MB.
Like the above, but with “release” settings; this is what I use to build the msi
file :-
./configure-win32 -v "C:\vcpkg\installed\x64-windows-static" -rsz
oix.exe
is about 870KB.
Compile with dynamic linking to the runtime, again using ssl and zlib :-
# PATH must include C:\vcpkg\installed\x64-windows\debug\bin
./configure-win32 -v "C:\vcpkg\installed\x64-windows" -Dsz
oix.exe
is about 1MB.
And the same, with release settings (note the slightly different PATH setting) :-
# PATH must include C:\vcpkg\installed\x64-windows\bin
./configure-win32 -v "C:\vcpkg\installed\x64-windows" -Dszr
oix.exe
is about 590KB.
Amongst other things, the configure-win32
script creates a paths.sh
file, which can be used to set the various Object Icon environment variables from within the cygwin bash shell, and paths.bat
which sets the same variables from within the Windows command line.