Subject: Re: DLL problems.

From: Jan Wielemaker <[email-masked]>
Date: Tue, 8 Jun 1999 12:51:01 +0200

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