Re: Problems linking c++/SWI executable for Windows
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 11/07/2013 12:34 AM, Kaitain Jones wrote:
> > I was also a bit astonished that MSVC can silently link to MinGW's .dll.a
> > files after renaming them, but the result simply crashes in a way
> which no
> > debugger can make sense of :-( Please try a simple hello-world like app
> > first, so you are sure there are no weird things going on. Also make
> > sure there are no traces of renamed .dll.a files ...
>
> Just to clarify, were you able to run a 32-bit exe, embedding SWI,
> compiled and linked using MSVC, or were you only able to compile and
> link it? And were you able to try 64-bit?
>
> To reiterate, I can now compile, link and run a 64-bit exe using MSVC,
> make queries to SWIPL, iterate through solutions etc. Everything looks
> good so far. But 32-bit blows up instantly, and doesn't even get into
> Main...sounds like you encountered this as well..?
That very much is what happened when I tried to link to libswipl.dll.a
from MinGW using MSVC. But, with the new .lib file, I get the attached
result (packed with tar and gzip as virus checkers often dislike .zip
files :-).
The proof is in script.txt, which is below
--- Jan
===============================================================
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>dir
Volume in drive C has no label.
Volume Serial Number is 9C54-E2FE
Directory of C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32
11/07/2013 12:15 PM <DIR> .
11/07/2013 12:15 PM <DIR> ..
10/31/2013 02:34 PM 631 hello.c
11/07/2013 12:13 PM 37,376 hello.exe
11/07/2013 12:13 PM 1,713 hello.obj
10/31/2013 02:35 PM 83 make.cmd
10/31/2013 02:36 PM 303 setvars.bat
5 File(s) 40,106 bytes
2 Dir(s) 5,132,341,248 bytes free
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>call setvars.bat
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>set
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo
ws\System32\WindowsPowerShell\v1.0
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>call "C:\Program Files
(x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.
bat" 1>nul
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>set
SWI_HOME_DIR=E:\mingw32\swipl
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>set
LIB=E:\mingw32\swipl\lib;C:\Program Files (x86)\Microsoft Visual Stud
io 9.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\LIB;C:\Program Files\Microsoft SDKs\Windows\v
7.0\lib;
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>set
PATH=E:\mingw32\swipl\bin;C:\Program Files (x86)\Microsoft Visual Stu
dio 9.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual St
udio 9.0\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio
9.0\Common7\Tools\bin;C:\Windows\Microsoft.NET\Fra
mework\;C:\Windows\Microsoft.NET\Framework\\Microsoft .NET Framework 3.5
(Pre-Release Version);C:\Windows\Microsoft.NET\
Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\VCPackages;C:\Program Files\Microsoft SDKs\Wi
ndows\v7.0\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>make
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>rem call setvars.bat
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>cl /DEBUG
-I"E:\mingw32\swipl\include" hello.c libswipl.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
hello.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello.exe
hello.obj
libswipl.lib
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>hello list
Hello list!
C:\Users\Jan Wielemaker\src\swipl-to-c\msvc-32>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc32-demo.tgz
Type: application/x-compressed-tar
Size: 1474 bytes
Desc: msvc32-demo.tgz
URL: <https://lists.iai.uni-bonn.de/pipermail/swi-prolog/attachments/20131107/18ee9e72/attachment.bin>