Language Bindings [was Re: [sword-devel] DLL]

Troy A. Griffitts sword-devel@crosswire.org
Wed, 16 Aug 2000 19:25:07 -0700


> I hate to appear pushy, but has this been done yet?  If not, can someone
> supply instructions on how to do this and I might give it a go myself.

My apologies for not following through on this.  I would love for
someone intending to use this DLL to take over the maintenance of the
DLL.

Actually this work will benefit all of those wishing to have other
language bindings to the SWORD API.  Anyone interested in this?  Please
volunteer.


It's not much coding work to make this happen, but some imagination may
be required :)  There is a project file (that probably won't work with
the newer versions of any of the compilers) in 
sword/apps/windoze/bcowl25/swordapi that was used to create the old DLL.

Actually, I just looked at the code and it is pretty lame.  In
actuality, to do it correctly, there should be at least 2 files written:

swmgrc.cpp
swmodulec.cpp

these should be handle-based, extern "C" declared functions of all the
members of class SWMgr and SWModule.  The handle should be an (unsigned
long) cast of the address of the object.  eg.

typedef unsigned long SWOBJECT;

SWOBJECT swmgr_new() {
	return (SWOBJECT) new SWMgr();
}

void swmgr_delete(SWOBJECT mgr) {
	delete (SWMgr *) mgr;
}


You may have to get a little creative with some functionality achieved
by STL:

void swmgr_getmodlist(SWOBJECT mgr, char **toArray) {
...
}

SWOBJECT swmgr_findmod(SWOBJECT mgr, const char *modname) {
...
}


Any volunteers?  Thoughts?

		-Troy.

	

> 
> In Christ,
> 
> Chris Marsh
> 
> Analyst Programmer
> Hansen Corporation
> Ph:     (03) 9843 8438
> Fax:    (03) 9843 8590
> 
> -----Original Message-----
> From: scribe@crosswire.org [mailto:scribe@crosswire.org]
> Sent: Wednesday, 5 July 2000 10:43
> To: sword-devel@crosswire.org
> Subject: Re: [sword-devel] DLL
> 
> I will build a new DLL when I get back in town.  The code for the DLL
> has not been updated for quite some time.  There is a difference with
> other language bindings to C++.  They need to be standard C procedural
> methods.  You actually could do C++ to Delphi provided no multiple
> inheritance (which we do), but other languages need a standard sig on
> the methods in the DLL (no C++ manglings).  Anyway, until I get it done,
> you should be able to play with a really old version on the site at:
> ftp://ftp.crosswire.org/pub/sword/attic/dlls.tar.gz
> 
> I think it's dated '97, so beware.  Though, this is probably good, since
> the delphi code hasn't been changed since then either :)
> 
> Hope this helps.  I actually need to do this anyway, since we seem to
> have requests for a number of other language bindings.
> 
>         -Troy.
> 
> Chris Marsh wrote:
> >
> > What we need here is someone with c++ experience (not me, yet) to create
> > these DLL's for us plebs used to visual tools like Delphi & VB.  I don't
> > even have a c++ compiler to use and certainly don't know how to create a
> DLL
> > even if I had a compiler.
> >
> > Any volunteers?
> >
> > Chris Marsh
> >
> > Analyst Programmer
> > Hansen Corporation
> > Ph:     (03) 9843 8438
> > Fax:    (03) 9843 8590
> >
> > -----Original Message-----
> > From: Philip Kapusta [mailto:info@pc-shareware.com]
> > Sent: Wednesday, 5 July 2000 8:44
> > To: sword-devel@crosswire.org
> > Subject: [sword-devel] DLL
> >
> > > But you can use DLLs generated by C++-Builder or whatever in Delphi!
> >
> > True, that is IF a DLL existed in the distribution ZIP.
> >
> > > Isn't there an DLL  shipped with the SWORD windows frontend?
> >
> > No.  I found not a single .DLL file in the version 1.5 package or previous
> > version.
> >
> > Philip
> >
> > **********************************************************************
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > the system manager.
> >
> > This footnote also confirms that this email message has been swept by
> > MIMEsweeper for the presence of computer viruses.
> >
> > www.mimesweeper.com
> > **********************************************************************