On 6 August 2018 at 23:54, Ben Coman <btc@openinworld.com> wrote:

On 6 August 2018 at 13:22, Ben Coman <btc@openinworld.com> wrote:
> and ends up with 4 link errors (and 6600 warnings)
> Pharo.exe LNK1120 - 1 unresolved external
> Pharow.exe LNK1120 - 1unresolved external
> sqMain.c.obj LNK2019 - unresolved external symbol _imp_osvm_main��referenced in function main
> sqWin32Main.c.obj LNK2019 - unresolved external symbol _imp_osvm_main referenced in function WinMain


So the following change to sqMain.c fixes the link error...
�� ����#define BUILD_VM_CORE
�� �� #include "OpenSmalltalkVM.h"
�� �� int
�� �� main(int argc, const char **argv)
�� �� {
�� �� �� �� return osvm_main(argc, argv);
�� �� }

and similar for sqWin32Main.c.


The next roadbump is...
LNK2019 unresolved external symbol 'alloca' referenced in function callIA32IntegralReturn�� -- File PharoVMCore.lib(xabicc.c.obj)

From the root folder, doing...
�� ��find . -name xabicc.c��
result in...
�� ��./platforms/Cross/plugins/IA32ABI/xabicc.c


Googling for "alloca Visual Studio 2017" lead me to...
�� ��https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca
which indicates there is no "alloca" only "_alloca"

Now " xabicc.c"��is a stub for including platform specific C code,
and the lovely defines-highlighting of��Visual Studio indicates "x64win64abicc.c" is the active one right now,
so as a quick hack, jamming��a define just above that include...��

�� #if i386|i486|i586|i686
�� #�� include "ia32abicc.c"
�� #elif powerpc|ppc
�� #�� include "ppc32abicc.c"
�� #elif x86_64|x64|__x86_64|__x86_64__|_M_AMD64|_M_X64
�� # if _WIN64
�� #�� �� ��define alloca _alloca�� ��// <<<QUICK HACK
�� #�� �� ��include "x64win64abicc.c"
�� #�� else
�� #�� �� ��include "x64sysvabicc.c"
�� #�� endif
�� #elif __ARM_ARCH__|__arm__|__arm32__|ARM32
�� #�� include "arm32abicc.c"
�� #endif


allows CMake > Build All
==> Build succeeded.�� ��Yay!

To determine a suitable permanent home for that define, doing...
�� ��grep -R " _alloca"�� *��
from the root folder��shows...
�� platforms/Cross/plugins/IA32ABI/arm32abicc.c:# define alloca _alloca
�� platforms/Cross/plugins/IA32ABI/ia32abicc.c:# define alloca _alloca
�� platforms/Cross/plugins/IA32ABI/ppc32abicc.c:# define alloca _alloca
�� platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c:# define alloca _alloca
�� platforms/minheadless/windows/sqPlatformSpecific-Win32.h:#�� �� define alloca _alloca
�� platforms/unix/config/configure:#�� define alloca _alloca
�� platforms/win32/vm/sqPlatformSpecific.h:#�� �� define alloca _alloca
�� processors/ARM/gdb-7.10/include/alloca-conf.h:#�� �� define alloca _alloca
�� processors/IA32/bochs/bx_debug/parser.c:#�� �� define alloca _alloca
�� src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c:# define alloca _alloca
�� src/plugins/SqueakFFIPrims/IA32FFIPlugin.c:# define alloca _alloca
�� src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c:# define alloca _alloca
�� src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c:# define alloca _alloca

Interesting that there is a similar define for��ia32abicc.c,
so comparing that with��x64win64abicc.c (at��https://www.diffchecker.com/mqCWMaTV)
looks like it should be slotted into the latter about line 41.
Doing that ==> Build successful.

cheers -ben