r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

Oldes
5-Nov-2010
[1509]
Where to start when I would like to learn how to write own extension? 
This page is out -of-date:/
http://www.rebol.com/r3/docs/concepts/extensions-examples.html
Andreas
5-Nov-2010
[1510]
Here's a minimal example of an extension:
https://gist.github.com/0677266b8511d83ce76a
GrahamC
5-Nov-2010
[1511]
Also christian did an ODBC extension
Oldes
5-Nov-2010
[1512]
fine... I can compile the minimal example, have problems with the 
samples above. The ODBC source is where?
Andreas
5-Nov-2010
[1513]
don't think the odbc sources are published at the moment
GrahamC
5-Nov-2010
[1514]
see the announce group
Andreas
5-Nov-2010
[1515x2]
the primary change compared to the docs is that many things have 
been renamed
some things
Oldes
5-Nov-2010
[1517]
I don't see the ODBC source, only link to dll and docs.
GrahamC
5-Nov-2010
[1518x4]
Hmm... I thought I once saw the source
maybe that was the first attempt....
AFAIK his is the only working extension released
I did some early extensions .. but I doubt that they work now
Oldes
5-Nov-2010
[1522x2]
With the sample2.c example I have problem with undefined RXI_SERIES_INFO 
and RXI_GET_CHAR
(I'm using #include "reb-host.h" from A110)
Andreas
5-Nov-2010
[1524]
I think RXI_SERIES_INFO is now RL_SERIES
Oldes
5-Nov-2010
[1525x2]
works
with RL_GET_CHAR
Andreas
5-Nov-2010
[1527x4]
i think you could also replace RXI_GET_CHAR by first obtaining a 
pointer using RL_SERIES(ser, RXI_SER_DATA) and then just indexing 
into this directly
well, RL_GET_CHAR is probably better
all RL_* functions are safe to call from extensions
(macros, safe to use)
jocko
6-Nov-2010
[1531]
I did several extensions for windows, and you can find the source 
code and the dlls here: http://www.colineau.fr/rebol/R3_extensions.html
. This code may not be up to date, but recently I have compiled new 
versions. If necessary, I can upload them.
GrahamC
6-Nov-2010
[1532]
Oops, I forgot about your stuff jocko .. does it all still work?
Oldes
6-Nov-2010
[1533]
I would appreciate a very simple example how to make extension using 
external DLL. So I could write for example ImageMagick extension.
Pekr
6-Nov-2010
[1534x2]
Max was supposed to bing kind of R2 DLL interface in R3, but ... 
:-)
bing=bring
jocko
6-Nov-2010
[1536x2]
funny, I intended also to try interfacing with ImageMagick (maybe 
the ImageMagick Com + component.), as I have a need for another project.

Concerning the extensions dll's and source files, I think that they 
are no more compatible. I should check and put the latest versions.
pages updated with the new versions (binaries and sources) compatibles 
a110 :
http://www.colineau.fr/rebol/R3_extensions.html
Oldes
6-Nov-2010
[1538]
I use IM extensively with R2 so I will need it with R3 as well. I 
think it must be easy.. if you know where to start.
Maxim
8-Nov-2010
[1539]
if you download the OpenGL demo, there is a complete working setup. 
 it has a makefile and a visual studio 2008 setup .  it should help 
you out.
Oldes
8-Nov-2010
[1540x3]
I'm completely C/C++ newbie, so I would like to know, how to make 
the extension, if I have precompiled DLL.
For example, In R2 I can simply download the DLL like this one:
http://zlib.net/zlib125-dll.zip

And simply do:

zlib.dll: load/library %zlib1.dll

zlib-version: make routine! [ return: [string!] ] zlib.dll "zlibVersion"
zlib-version
;== "1.2.5"


Is there someone who can write a simple tutorial - C extension with 
the zlib-version command?
I understand the REBOL part of it, but would like to see how to do 
the DLL trick part. Including the correct gcc command.
I would like to start with simple gcc instead of dealing with VS 
projects.
jocko
8-Nov-2010
[1543]
Oldes, I have uploaded an ImageMagick extension.
GrahamC
8-Nov-2010
[1544]
Nice
Andreas
8-Nov-2010
[1545]
Oldes, I've built you a simple "zlib-version" extension.
Oldes
8-Nov-2010
[1546x2]
Could you upload the C source as well? Btw.. I would rather use linkage 
to MagickWand.dll to be able use direct commands instead of command 
line like IM commands.
Great, I will check the zlib:) I'm looking forward to learn something.
Andreas
8-Nov-2010
[1548x5]
No tutorial yet, but see I hope it helps nevertheless:
http://bolka.at/2010/rebol3/ext-zlib-20101108.zip
Extract this into your hostkit folder, so that you'll have an ext-zlib/ 
folder in the hostkit.
Then run make, and you should see something like the following:
$ make

gcc -DTO_WIN32 -I ../src/include -I include -mdll -L . -lzlib1 -o 
zlib.dll zlib.c
Afterwards you should have a fresh "zlib.dll" which is the extension.
Now run the accompanying zlib.r, and you should get:
$ r3-a110-3-1 -q zlib.r
1.2.5
Oldes
8-Nov-2010
[1553x2]
it works.. thanks.. but I must say, that in R2 it was easier;-)
is there a reason why there is:
#include <stdio.h>
#include <string.h> 
?
Andreas
8-Nov-2010
[1555x2]
stdio.h is a leftover and not needed.
string.h is for strlen.
Oldes
8-Nov-2010
[1557]
And isn't the conversion to a REBOL string quite complicated?
Andreas
8-Nov-2010
[1558]
Yes, a bit. There may be a simpler way. Or we could bundle a few 
such helper functions into a support library (as Max did in his OpenGL 
work).