From jan@swi.psy.uva.nl  Tue Jun  8 12:54:27 1999
Received: from gollem.swi.psy.uva.nl (jan@gollem.swi.psy.uva.nl [145.18.114.15])
	by swi.swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id MAA23481
	for <prolog@swi.psy.uva.nl>; Tue, 8 Jun 1999 12:54:27 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.8.8/8.8.8) id MAA17238;
	Tue, 8 Jun 1999 12:55:49 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
To: prolog@swi.psy.uva.nl, "Sergio Arias Sanchez" <SARIAS@sag.es>
Subject: Re: DLL problems.
Date: Tue, 8 Jun 1999 12:51:01 +0200
X-Mailer: KMail [version 0.7.9]
Content-Type: text/plain
References: <s75d0a31.096@sag.es>
MIME-Version: 1.0
Message-Id: <99060812554902.15948@gollem>
Content-Transfer-Encoding: 8bit

On Tue, 08 Jun 1999, Sergio Arias Sanchez wrote:
>Hi everybody.
>
> I defined a DLL (Windows NTv 4, MSVC++ 5.0) to be used in my prolog programs
> (SWI Prolog v 3.2.7). The problem is that whenever I try to load with 
>load_foreign_library/1, it fails when calling entry point install.
>
>  Right now, I just have the following:
>
>  #include <SWI-Prolog.h>
>  #include <stdio.h>
>
>  static foreign_t pl_hw()
>  {      return printf("\n Hello world\n");
>  }
>
>  install_t install()
>  {      PL_register_foreign("hw", 0, pl_hw, 0);
>  }
>
>
>  What's wrong?

Looks fine, except printf() is quite useless in GUI context.  This
should run on top op plcon.exe, but not plwin.exe.  Use the replacements
from SWI-Stream.h for that (undocumented, but their operation should be
obvious for someone knowing stdio).

Loading however should be fine.  Please be more specific about what
you are doing.  Where is the .DLL file?  Can you verify install() is
indeed exported from it (using dumpbin (?) or so).  How do you call
load_foreign_library/1 and what is the exact message?

	Regards --- Jan

