1. Deeper into the Data

Hello All:

I have been watching with great interest the progress of the language known
as EUPHORIA for some time.  especially the progress of late in the arena of
database developement. It has also come to my attention that Inprise
(Borland) has open-sourced it's client/server product, Interbase(get your
copy atBorland's site) I would be very thrilled to see the two worlds
collied (I mean come together =o) ) perhaps along the line of the MySQL
wrapper I've seen for Euphoria. I,m not as advanced as many of you are in
developing this type of wrapper and thoughts on where to start would be
mucho appreciated.

New to the list.
Steve

new topic     » topic index » view message » categorize

2. Re: Deeper into the Data

Hi Steve,

Interbase comes with a dll library that allows access to the DB server.  You
need to look at the header file(s) "*.h"  that define the routines for this
dll.

Then you have to write wrappers in Euphoria for each function that you want
to use from Euphoria.

First you have to open the dll library with a "dll_open" Euphoria command,
then link each function or procedure you wish to use with "define_c_func" or
"define_c_proc" Euphoria commands.
Then when you want to use the functions / procedures from the dll use
"call_proc" or "call_func" Euphoria commands.

You will also need to understand how to pass/receive Euphoria data to "C"
data structures.
Check out the library.doc doco that comes with Euphoria and read all about
the above commands.  Then check out any of the programs at the archive or
recent user contributions that use external libraries.  Win32lib as an
example.

Once you have done all that and you have any questions just ask again!

Ray Smith





> Hello All:
>
> I have been watching with great interest the progress of the language
known
> as EUPHORIA for some time.  especially the progress of late in the arena
of
> database developement. It has also come to my attention that Inprise
> (Borland) has open-sourced it's client/server product, Interbase(get your
> copy atBorland's site) I would be very thrilled to see the two worlds
> collied (I mean come together =o) ) perhaps along the line of the MySQL
> wrapper I've seen for Euphoria. I,m not as advanced as many of you are in
> developing this type of wrapper and thoughts on where to start would be
> mucho appreciated.
>
> New to the list.
> Steve

new topic     » goto parent     » topic index » view message » categorize

3. Re: Deeper into the Data

Ray Smith wrote:

> Interbase comes with a dll library that allows access
> to the DB server.  You need to look at the header file(s)
> "*.h"  that define the routines for this dll.
>
> Then you have to write wrappers in Euphoria for each
> function that you want to use from Euphoria.

If the Interbase API routines deal with plain C types (char*, int, double),
you might want to take a look at my SWIG/Euphoria program. Instead of
building the wrappers by hand, just copy the prototypes of the functions
that you want into a text file called "interbase.i". Add the command:

   %module interbase

to the top of the file, and then run SWIG with the command:

   swig interbase.i

(or "swig -c++ interbase.i" if the routines happen to be in C++ form). SWIG
will generate a couple of files:

   interbase.e - interface to "interbase.dll"
   interbase_wrap.c - c code to create "interbase.dll"
   interbase_wrap.doc - junk, not supported yet

Have a look at "interbase.e". You will have to change the code where it
interfaces to the dll:

   const dll_interbase = open_dll("interbase.dll")

But other than that, (if you are really lucky) it should have built the
Euphoria wrappers correctly.

If, on the other hand, the API uses a lot of custom structures, constant
values, and so on, you'll have to compile "interbase_wrap.c" into a dll and
rename the DLL to "interbase.dll". In that case, you'll need to take a bit
more care building the interface. You'll need to specify before the
protoypes which files to include:

   %{
   include "file1.h"
   include "file2.h"
   %}

where "file1.h" and "file2.h" are files you got the prototypes from, etc.
Either way, it's worth a try.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

4. Re: Deeper into the Data

David Cuny wrote:
>
> Ray Smith wrote:
>
> > Interbase comes with a dll library that allows access
> > to the DB server.  You need to look at the header file(s)
> > "*.h"  that define the routines for this dll.
> >
> > Then you have to write wrappers in Euphoria for each
> > function that you want to use from Euphoria.
>
> If the Interbase API routines deal with plain C types (char*,
> int, double),
> you might want to take a look at my SWIG/Euphoria program. Instead of
> building the wrappers by hand, just copy the prototypes of
> the functions
> that you want into a text file called "interbase.i".

I noticed that there is an interbase project on sourceforge, which might be
helpful if anyone decides to go forward with wrappers.

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu