From jan@swi.psy.uva.nl  Wed Aug  9 15:35:21 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id PAA18868;
	Wed, 9 Aug 2000 15:35:16 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id PAA08370;
	Wed, 9 Aug 2000 15:35:11 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Lionel Ains <lains@caramail.com>, prolog@swi.psy.uva.nl
Subject: Re: DLL loading problem with plcon
Date: Wed, 9 Aug 2000 15:25:35 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <965826329000449@caramail.com>
In-Reply-To: <965826329000449@caramail.com>
MIME-Version: 1.0
Message-Id: <00080915351108.20043@gollem>
Content-Transfer-Encoding: 8bit

On Wed, 09 Aug 2000, Lionel Ains wrote:
>> De : Jan Wielemaker <jan@swi.psy.uva.nl>
>> To create executables, just do
>>
>> 	plcon -g go -o myprog -c prog.pl
>>
>> which will create myprog(.exe on Windows).
>>
>> 	Regards --- Jan
>You're perfectly right, it's quite complicated but I've switched back to this command line compilation
>after having problems with plcon.exe. I was using the "plcon -o" command line as well before having
>problems with DLL loading.
>In fact, I've realised that plcon was not crashing but simply not outputting messages anymore.
>After loading the foreign language library, no prompt, nor even compilation message is printed
>anymore. Prolog is still running but all its output is muted.
>However, I can get all the messages when I redirect the output to a file on plcon's command-line.
>This must be the reason why I don't have any problem with plwin.exe because I guess that the output
>to the Window is handled a different way.

Yes.  All I/O of Prolog is handed by Prolog streams.  By default the
user I/O streams refer to the POSIX file descriptors 0, 1 and 2.  In
case of plwin.exe, these are rebound to functions reading from and
writing to this window.

So, if your library plays around with these file descriptors, plcon.exe
will be affected, but plwin.exe not.  This looks like the most promising
thing to look at.

>Would there be a few Prolog environment variables that I could check to be sure that the output is set
>correctly?

Not really.  To confirm my hypothesis you could try to add a foreign
procudure

say_hello()
{ msg = "Hello World\n";

  write(0, msg, strlen(msg));
  return TRUE;
}

If this doesn't write after loading the library you should try to find
out what the library is doing to the filedescriptor.

	Regards --- Jan

