World: r3wp
[!REBOL3 Extensions] REBOL 3 Extensions discussions
older newer | first last |
GrahamC 5-Nov-2010 [1519x3] | 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 [1558x3] | 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). |
Also note that this is not really comparable to using dlls with the /Library stuff in R2. | |
This facility simply did not exist in R2. On the other hand, /Library does not yet exist for R3 (but only because no one has written it yet). | |
Oldes 8-Nov-2010 [1561] | I know. This is a good start for me:) btw. is it possible to create extzlib.dll which would contain the zlib1.dll? I don't need it, just asking. |
Andreas 8-Nov-2010 [1562x4] | Yes and no. |
Yes, you can create an extension which contains the zlib library. | |
No, you can't do that from zlib1.dll, you'd have to use the zdll.lib in lib/. | |
You'd use gcc -DTO_WIN32 -I ../src/include -I include -mdll -o zlib.dll zlib.c lib/zdll.lib to statically link zlib into your extension (still called zlib.dll in the above). | |
Oldes 8-Nov-2010 [1566] | are you sure? with this version the zlib1.dll is still required |
Andreas 8-Nov-2010 [1567] | Hmm, then zdll.lib probably is an import dll. Let me check. |
jocko 8-Nov-2010 [1568] | developing an extension to wrap MagickWand is a huge work, because of the large number of functions, and data formats. It's better, in this case, to develop a full dedicated application in c, or, at least a dll with higher level functions ... wihch is approximately the case of ImageMagickObject. In other words, I am not convinced of the interest to program in Rebol if you want to use the full set of low level image processing functions. |
older newer | first last |