Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #58706
| From | Andreas Klimas <klimas@w3group.de> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: gforth and shared libraries |
| Date | 2017-05-05 17:44 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <oei6du$fpu$1@dont-email.me> (permalink) |
| References | <oei3tg$6e4$1@dont-email.me> |
sorry, I have found the solution in the gforth documentation now
"5.25.8 Low-Level C Interface Words
open-lib c-addr1 u1 ? u2 gforth ?open-lib?
lib-sym c-addr1 u1 u2 ? u3 gforth ?lib-sym?
lib-error ? c-addr u gforth ?lib-error?
Error message for last failed open-lib or lib-sym.
call-c ... w ? ... gforth ?call-c?
Call the C function pointed to by w. The C function has to access the
stack itself. The stack pointers are exported in the global variables
gforth_SP and gforth_FP."
my mistake was in using wcall instead of call-c (I think).
Now all is working fine.
> Hello,
>
> for my work I would have access to shared libraries.
> unfortunately the source code of gforth is not trivial and
> hence I have found and tryied so far:
>
> s" db/script.so" open-lib constant so \ load my small dynamic link lib
> s" script" so lib-sym wcall \ call the function script
>
> I set a breakpoint at script() but ..
>
> Breakpoint 1, script (args=0x2aaaac0ff000 "") at script.c:10
> 10 printf("<h1>Hello From Script</h1>");
> (gdb) bt
> #0 script (args=0x2aaaac0ff000 "") at script.c:10
> #1 0x0000000000408edc in gforth_engine (ip0=0x2aaaac0ff000,
> ip0@entry=0x2aaaab903620, sp0=0x2aaaac0feff8, rp0=0x408ebc,
> rp0@entry=0x2aaaac108c00, fp0=0x2aaaac104000, lp0=0x6c <Address
> 0x6c out of bounds>, lp0@entry=0x2aaaac10da00 "") at prim:2480
> #2 0x0000000000411a3b in gforth_go (image=image@entry=0x2aaaab8f9038,
> stack=<optimized out>, stack@entry=4,
> entries=entries@entry=0x7fffffffe4b0) at ./main.c:754
> #3 0x0000000000404513 in main (argc=<optimized out>, argv=<optimized
> out>, env=<optimized out>) at ./main.c:2349
>
> I only can guess what the meaning of the parameters ip0, ip0@entry ... are
>
> I even haven't found anything in the documentation about open-lib,
> lib-sym and wcall
> (there are more system related words to explore)
>
> so, how is the interface for wcall defined ?
>
> I would be grateful for any help
>
> best wishes
> Andreas Klimas
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-05 17:01 +0200
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-05 17:44 +0200
Re: gforth and shared libraries anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-06 16:24 +0000
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-07 10:48 +0200
Re: gforth and shared libraries anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-07 10:03 +0000
Re: gforth and shared libraries albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-07 13:40 +0200
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-07 22:27 +0200
Re: gforth and shared libraries Bernd Paysan <bernd@net2o.de> - 2017-05-07 23:57 +0000
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-08 10:44 +0200
Re: gforth and shared libraries anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-08 11:26 +0000
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-08 17:08 +0200
Re: gforth and shared libraries pahihu <pahihu@gmail.com> - 2017-05-09 10:31 -0700
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-10 09:40 +0200
Re: gforth and shared libraries albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-07 13:37 +0200
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-07 22:50 +0200
Re: gforth and shared libraries minforth@arcor.de - 2017-05-07 14:41 -0700
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-08 10:49 +0200
Re: gforth and shared libraries minforth@arcor.de - 2017-05-08 02:16 -0700
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-08 16:32 +0200
Re: gforth and shared libraries minforth@arcor.de - 2017-05-08 08:00 -0700
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-08 17:52 +0200
Re: gforth and shared libraries minforth@arcor.de - 2017-05-08 09:33 -0700
Re: gforth and shared libraries anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-09 15:44 +0000
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-10 09:51 +0200
Re: gforth and shared libraries anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-10 10:16 +0000
Re: gforth and shared libraries Andreas Klimas <klimas@w3group.de> - 2017-05-10 12:31 +0200
Re: gforth and shared libraries albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-10 12:51 +0200
csiph-web