Subject: SWI-P Win32 port embedding problem

From: "Petr Kocmid" <[email-masked]>
Date: Mon, 6 Sep 1999 02:27:23 +0200

hello there everybody,

I joined this list 3 days ago, but not receiving any messages since, but it's weekend and maybe only professionals are here :-). Hope it is an active list.

I recompiled 3.2.9 source on win32 with Visual C++ 6/Service Pack3 and it works almost fine. That means prolog works perfectly, but plwin console has some font metrics problem on Windows98: cursor is misplaced by one or several pixels back on every character printed in line, so it is not usable for editing at all. But it does not matter for me since I do not need using it.

Another problem I have is with static embedded system. Here is the description:
PL_halt() calls Halt() which performs engine cleanup and exit(). This is not acceptable, since it prevents application to do something meaningfull after prolog engine has been shut. atexit() is not a solution for me, because 1. I need to embed prolog in Win32 GUI app, which opens and closes prolog session by user interaction (AI solver) and 2. want make C++ class wrapper around the engine, where constructor does PL_initialize() and destructor PL_halt() housekeeping.

I thing either this exit() call should be moved out of the Halt() to C stub code such as pl-ntcon.c and similars on other platforms or some more portable solution retaining backward compatibility will be perhaps PL_terminate() for embedded system doing only housekeeping or Prolog_exit() with callback setting. 
I shall investigate sources more for similar glitches because it prevents multithreading and other things (ANSI C++ exception unwinding for example). 

Perhaps I can help with swi multithreading features on win32. I plan to build COM object around the engine with dual interfaces and type library so it could be used from C++, Java, VBasic, MSOffice apps and so on.

I haven't played with prolog for more than 8 years so I tried about a dozen free implementations last month and must say, "SWI-Prolog is the best I have ever seen". It's portability is fascinating and as a C++ developer, I like the transparent module system very much. I am doing free 3D first person RPG game in C++ with open source 3D engine and want prolog to make automatic 3Dworld/scenario builder, inverse cinematics for digital actors and tactical combat decision AI.

Petr Kocmid
independent developer
[email-masked] ([email-masked])