From starred@tiscalinet.it Fri Aug  3 16:24:23 2001
Received: from smtp1.libero.it (smtp1.libero.it [193.70.192.51])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f73EOMb27740
	for <prolog@swi.psy.uva.nl>; Fri, 3 Aug 2001 16:24:22 +0200 (MET DST)
Received: from tiscalinet.it (151.24.145.69) by smtp1.libero.it (5.5.025)
        id 3AE980E7015B467E for prolog@swi.psy.uva.nl; Fri, 3 Aug 2001 16:24:21 +0200
Message-ID: <3B6AB42F.12B136FC@tiscalinet.it>
Date: Fri, 03 Aug 2001 16:24:47 +0200
From: Armando Stellato <starred@tiscalinet.it>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: SWI Mailing List <prolog@swi.psy.uva.nl>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [SWIPL] Problems with foreign libraries using dlls

Hi there,
I've gotta some problems in creating DLL containing external predicates
for prolog.
Before creating my own predicates, I tried to use the examples in the
manual.
I'm using windows version of SWI-Prolog 'cause of porting problems from
other works, but I'm not used to C compilers for Windows.
I tried to use 3 different compilers (lcc, Borland 5.5 free compiler and

Visual Basic), well, at least I succeeded in using one of them.
This is the procedure i followed with lcc compiler:

<created file "lowercase.c" from example>

from shell: lcc -c lowercase.c

<now lowercase.obj has been created>

<
created "lowercase.def" this way:

EXPORTS
    pl_lowercase

>

from shell: lcclnk -dll lowercase.obj libpl.lib lowercase.def

<
it was important to insert libpl.lib 'cause without this file,  it gave
me
the following errors:

lowercase.obj .text: undefined reference to '_PL_get_atom_chars'
lowercase.obj .text: undefined reference to '_PL_warning'
lowercase.obj .text: undefined reference to '_PL_unify_atom_chars'
lowercase.obj .text: undefined reference to '_PL_register_foreign'
>

so, once created the dll file, i imported it with
load_foreign_library(lowercase), but i obtained only this bad message:
it's impossible to find the entry point PL_Warning for the procedure in
the dynamic link library CRTDLL.DLL.

Is there someone out there that can solve my problem?

If you want, you can explain me what to do with Visual C++, but i'd like

a step-by-step procedure and a explanation of files to copy from (if
there are) SWI-Prolog, the files i've yet copied from the prolog
directory are: lib files form lib directory into the lib directory of
the c-compilers and the header files into the c-compilers-headers
directory.

Excuse my poor english and the length of this mail, but i tried to be as

clear as possible reporting ev'ry step i've done.

Thank u in advance

Armando Stellato





