From: Rob Blackwell
Subject: Calling CLIPS DLL from Visual Basic
Date: 
Message-ID: <3mdm5v$mfc@xenon.bt-sys.bt.co.uk>
CLIPS seems to be pretty LISP like, so I hope this is the right group 
for this posting ! 
 
I got hold of CLIPS 6 for MS Windows and the associated DLL from 
places referenced from http://www.jsc.nasa.gov/~clips/CLIPS.html 
 
I've been trying to call the CLIPS DLL from Visual Basic using declarations like : 
Declare Sub InitailzeCLIPS Lib "d:\data\reb\clips\dll\clipsdll.dll" Alias "_InitializeCLIPS" () 
and variations thereof, but Visual Basic just reports "Sub or Function not defined". 
 
If anybody has had any success in calling CLIPS as a DLL especially from Visual Basic, 
please email me. 
 
Regards, 
 
Rob. 

From: Alex Kilpatrick
Subject: Re: Calling CLIPS DLL from Visual Basic
Date: 
Message-ID: <3meemm$nrr@blackbird.afit.af.mil>
Rob Blackwell <·············@bt-sys.bt.co.uk> wrote:

>CLIPS seems to be pretty LISP like, so I hope this is the right group 
>for this posting ! 
> 
>I got hold of CLIPS 6 for MS Windows and the associated DLL from 
>places referenced from http://www.jsc.nasa.gov/~clips/CLIPS.html 
> 
>I've been trying to call the CLIPS DLL from Visual Basic using declarations like : 
>Declare Sub InitailzeCLIPS Lib "d:\data\reb\clips\dll\clipsdll.dll" Alias "_InitializeCLIPS" () 
>and variations thereof, but Visual Basic just reports "Sub or Function not defined". 
> 
>If anybody has had any success in calling CLIPS as a DLL especially from Visual Basic, 
>please email me. 

Well, I have been trying to get the CLIPS DLL to work under Allegro
CL/Windows 2.0, (under NT 3.5) without too much luck.  I would be
interested in hearing from anyone who has got this to work.

(cross-posted to comp.ai.shells)

Alex
From: Gary Riley
Subject: Re: Calling CLIPS DLL from Visual Basic
Date: 
Message-ID: <riley-1304951751140001@robomac.jsc.nasa.gov>
In article <··········@blackbird.afit.af.mil>, ········@afit.af.mil wrote:

> Rob Blackwell <·············@bt-sys.bt.co.uk> wrote:
> 
> >CLIPS seems to be pretty LISP like, so I hope this is the right group 
> >for this posting ! 
> > 
> >I got hold of CLIPS 6 for MS Windows and the associated DLL from 
> >places referenced from http://www.jsc.nasa.gov/~clips/CLIPS.html 
> > 
> >I've been trying to call the CLIPS DLL from Visual Basic using
declarations like : 
> >Declare Sub InitailzeCLIPS Lib "d:\data\reb\clips\dll\clipsdll.dll"
Alias "_InitializeCLIPS" () 
> >and variations thereof, but Visual Basic just reports "Sub or Function
not defined". 
> > 
> >If anybody has had any success in calling CLIPS as a DLL especially
from Visual Basic, 
> >please email me. 
> 
> Well, I have been trying to get the CLIPS DLL to work under Allegro
> CL/Windows 2.0, (under NT 3.5) without too much luck.  I would be
> interested in hearing from anyone who has got this to work.
> 
> (cross-posted to comp.ai.shells)
> 
> Alex

************************************************************************

The following response to a similar question was posted to the CLIPS 
list server recently.

Gary Riley
·····@gothamcity.jsc.nasa.gov

************************************************************************

On Wed, 5 Apr 1995, Jeffrey A. Richardson wrote:

> Has anyone tried calling the CLIPS 6.0 DLL from Visual Basic?  I have tried
> declaring it a doesn't different ways, and at run-time I always get the
> message 'Sub or function not defined".
>
> Thanks in advance,
>
> Jeff Richardson

Hello,

 I am also using the CLIPS DLL in my Visual Basic. I didn't declare the
DLL in my VB program. Here's what I did:

Went to the hubble.jsc.nasa.gov ftp site. There are two sample programs,
in the directory, (/pub/clips/Examples/6.0DLL), with the CLIPS 6.0 dll
zip file, one is TEST_C.ZIP and one is TEST_CPP.ZIP. The TEST_C.ZIP file
includes an example of using the DLL written in C, and the TEST_CPP.ZIP
includes an example written in C++ which also uses the CLIPS wrapper for
Borland C++

I took the TEST_C.ZIP and added my own .c file to it. The following
commands were used in the .c file:

#include <stdio.h>
extern "C"
{
#include "clips.h"
}

main()
{
initializeCLIPS();
(load "  ");  (file containing your clips code)
Reset();
Run(-1L);
}
I used the resulting .exe file in my VB program


In VB, I used the "Shell" command to execute my clips program



BUT

 I also had the "sub or fn not defined" problem  when I was trying to
create a DLL written in C. You have to declare your function as follows:

extern "C" int far pascal _export "FunctionName"(args)
{
 ---
 ---
}

In your general declarations section, you should declare it as:
 Declare Function "FnName"% Lib "DLL Location" (args)

There is a Visual Basic newsgroup where I learned all this!

Bye..

Ilango


--------------------------------------------------------------

On Wed, 5 Apr 1995, Jeffrey A. Richardson wrote:

> Has anyone tried calling the CLIPS 6.0 DLL from Visual Basic?  I have tried
> declaring it a doesn't different ways, and at run-time I always get the
> message 'Sub or function not defined".
>
> Thanks in advance,
>
> Jeff Richardson
>
>
I hope you exported a PASCAL "main" function from your CLIPS DLL. This is
your entry point to the DLL from your VB application. You cannot call
into the VB application so you need a go-between application or DLL to
arbitrate the communication.

Good Luck, devooght
From: ······@sticomet.com
Subject: Re: Calling CLIPS DLL from Visual Basic
Date: 
Message-ID: <3mlp0i$n6p@viper.mlb.sticomet.com>
In article <··········@blackbird.afit.af.mil>, <········@afit.af.mil> writes:

> Rob Blackwell <·············@bt-sys.bt.co.uk> wrote:
> 
> >CLIPS seems to be pretty LISP like, so I hope this is the right group 
> >for this posting ! 
> > 
> >I got hold of CLIPS 6 for MS Windows and the associated DLL from 
> >places referenced from http://www.jsc.nasa.gov/~clips/CLIPS.html 
> > 
> >I've been trying to call the CLIPS DLL from Visual Basic using declarations like : 
> >Declare Sub InitailzeCLIPS Lib "d:\data\reb\clips\dll\clipsdll.dll" Alias 
"_InitializeCLIPS" () 
> >and variations thereof, but Visual Basic just reports "Sub or Function not defined". 
> > 
> >If anybody has had any success in calling CLIPS as a DLL especially from Visual 
Basic, 
> >please email me. 
> 
> Well, I have been trying to get the CLIPS DLL to work under Allegro
> CL/Windows 2.0, (under NT 3.5) without too much luck.  I would be
> interested in hearing from anyone who has got this to work.
> 
> (cross-posted to comp.ai.shells)
> 
> Alex

I don't have any experience with CLIPS 6.0 but a couple of years ago I took
CLIPS 5.1 and converted it to a DLL (and have continued extending it). One item
that may be giving you trouble in VB is the location of the DLL.  VB is VERY
picky about finding DLLs and VBXs in the \WINDOWS\SYSTEM directory.  I am 
working on a VB front end for editing rules, facts, templates, etc. for my
DLL using VB.  Whenever I compile a new version of the DLL I move it to that
directory.

Also, the example you have is the key initialization function for CLIPS.  I
don't know how the CLIPS 6.0 DLL is put together but when I started with mine,
one of the assumptions I made was that I didn't want multiple DLL clients
calling the initialization function.  So, in MindLink (my working name for the
DLL) the initialization is performed automatically as part of the LibMain()
procedure called when the DLL is first loaded.  That was the engine is
initializes for the first client and you don't have to worry about later clients
coming in a trashing another applications data.

Other items that might cause problems (and things that I've tripped over) 
include the allocation of memory in the VB (or other) application to receive 
the print string of a rule or fact.


Vince Kovarik
From: Simon Beaumont
Subject: Re: Calling CLIPS DLL from Visual Basic
Date: 
Message-ID: <3me69n$ql5@xenon.bt-sys.bt.co.uk>
Rob Blackwell <·············@bt-sys.bt.co.uk> wrote:
>
> CLIPS seems to be pretty LISP like, so I hope this is the right group 
> for this posting ! 
..

try: news:comp.ai.shells there is a fair deal of clips activity there.

Simon