Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #16556 > unrolled thread

Create Shared Library For Linux

Started bydeech <aditya.siram@gmail.com>
First post2012-10-21 19:59 -0700
Last post2012-10-30 17:57 -0700
Articles 5 — 5 participants

Back to article view | Back to comp.lang.forth


Contents

  Create Shared Library For Linux deech <aditya.siram@gmail.com> - 2012-10-21 19:59 -0700
    Re: Create Shared Library For Linux "David N. Williams" <williams@umich.edu> - 2012-10-22 08:31 -0500
    Re: Create Shared Library For Linux Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-22 18:16 +0200
    Re: Create Shared Library For Linux The Beez <the.beez.speaks@gmail.com> - 2012-10-25 06:55 -0700
    Re: Create Shared Library For Linux krishna.myneni@ccreweb.org - 2012-10-30 17:57 -0700

#16556 — Create Shared Library For Linux

Fromdeech <aditya.siram@gmail.com>
Date2012-10-21 19:59 -0700
SubjectCreate Shared Library For Linux
Message-ID<eb25b5b4-fd42-4545-ba30-454623c97622@googlegroups.com>
Hi all,
I'm looking for a Forth with which I can make a shared library on Linux that can be called from C. The couple I've seen so far, Reva [1] and kForth [2] can only call C libraries. Do you know of any that have what I'm looking for?

thanks!
-deech

[1] http://dev.ronware.org/p/reva/home
[2] http://ccreweb.org/software/kforth/kforth.html

[toc] | [next] | [standalone]


#16573

From"David N. Williams" <williams@umich.edu>
Date2012-10-22 08:31 -0500
Message-ID<k63hs3$o7$1@dont-email.me>
In reply to#16556
On 10/21/12 9:59 PM, deech wrote:> Hi all,
 > I'm looking for a Forth with which I can make a shared library
 > on Linux that can be called from C. The couple I've seen so far,
 > Reva [1] and kForth [2] can only call C libraries. Do you know
 > of any that have what I'm looking for?

All Forth words in pfe are in shared libraries, with the default
build.

   http://pfe.sourceforge.net/
   http://pfe.svn.sourceforge.net/viewvc/pfe/trunk/pfe-33/
   http://pfe.svn.sourceforge.net/viewvc/pfe/branches/dnw/

My branch in the last link above is AFAIK the more up to date.
Instructions for using that repository are here:

   http://www.umich.edu/~williams/archive/forth/pfe/pfefromsvn.html

To call from C, you need to include the pfe includes:

   #include <pfe/pfe-base.h>

I think that's described, along with how to call words,
somewhere in the documentation at the first link above, but ask
if it's not easy to find.

Examples for the reverse direction, binding C libraries as pfe
Forth words, are under "pfe bindings" here:

   http://www.umich.edu/~williams/archive/forth/gmpfr/

-- David

[toc] | [prev] | [next] | [standalone]


#16582

FromBernd Paysan <bernd.paysan@gmx.de>
Date2012-10-22 18:16 +0200
Message-ID<8718063.t8ztxXmeqg@sunwukong.fritz.box>
In reply to#16556
deech wrote:

> Hi all,
> I'm looking for a Forth with which I can make a shared library on
> Linux that can be called from C. The couple I've seen so far, Reva [1]
> and kForth [2] can only call C libraries. Do you know of any that have
> what I'm looking for?

The current development branch of Gforth can compile Gforth as a shared 
library.  However, we don't yet have a way to generate C bindings for 
Forth words in a neat way (i.e. a way which would look like a C shared 
library from the outside).

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#16696

FromThe Beez <the.beez.speaks@gmail.com>
Date2012-10-25 06:55 -0700
Message-ID<8021e24e-d9ec-4542-9e16-64c59d97f819@r10g2000vby.googlegroups.com>
In reply to#16556
On Oct 22, 4:59 am, deech <aditya.si...@gmail.com> wrote:
You can take a look at 4tH. 4tH can be compiled as a shared library.
You can compile 4tH snippets and keep 'em in memory to be called
separately. Large development guide on all that.

http://freecode.com/projects/4th

Hans Bezemer

[toc] | [prev] | [next] | [standalone]


#16851

Fromkrishna.myneni@ccreweb.org
Date2012-10-30 17:57 -0700
Message-ID<69d88746-b81a-4431-8d2e-6c690588b00d@googlegroups.com>
In reply to#16556
On Sunday, October 21, 2012 9:59:59 PM UTC-5, deech wrote:
> Hi all,
> 
> I'm looking for a Forth with which I can make a shared library on Linux that can be called from C. The couple I've seen so far, Reva [1] and kForth [2] can only call C libraries. Do you know of any that have what I'm looking for?
> 
> 
> 
> thanks!
> 
> -deech
> 
> 
> 
> [1] http://dev.ronware.org/p/reva/home
> 
> [2] http://ccreweb.org/software/kforth/kforth.html


While kForth does not have the machinery to create a standalone shared object library, e.g. a .so library, we note that the source code for kForth can be compiled and linked as part of a C/C++ project. This allows the main application to both execute Forth source, and for Forth source to call C functions in the application. kForth has been designed specifically to make such embedding easy. We use this design to make the application, xyplot, user extensible. The user can write modules in kForth which provide additional functionality, e.g. creating new menus, and menu items associated with Forth words, and drawing in an X/Motif window by executing C functions from the rest of the application code. Please take a look at the xyplot home page, and at its source code (in particular the xyplot.cpp file) for an example of how this is accomplished.

Cheers,
Krishna

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web