World: r3wp
[!REBOL3 Extensions] REBOL 3 Extensions discussions
older newer | first last |
Andreas 5-Nov-2010 [1528x3] | 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. |
Maxim 8-Nov-2010 [1569] | yes, its VERY usefull... one doesn't want to have to compile applications and stuff... AFAIK there are binding to other languages which use the full IM suite. but yes its a lot of work. |
Andreas 8-Nov-2010 [1570] | (Yes, lib/zdll.lib seems to be an import library. So no static linking against it. Sorry for the confusion.) |
Oldes 8-Nov-2010 [1571x3] | Jocko, I don't think it's so much work. For example in R2 I use this: http://box.lebeda.ws/~hmm/rebol/im-min.r |
Of course, better to use REBOL script to make the C code. Btw. your version is not working here. I get this result: Error (null) (0x80040154) Error (null) (0x80040154) Error (null) (0x80040154) Error (null) (0x80040154) Error (null) (0x80040154) Error (null) (0x80040154) | |
Also is it possible to use your version to for example load TIFF image into REBOL? | |
jocko 8-Nov-2010 [1574] | Have you installed ImageMagick , and ImageMagickObject ? |
Oldes 8-Nov-2010 [1575] | I have ImageMagick instaled. If installing ImageMagickObject means: regsvr32 /c /s ImageMagickObject.dll than I have it as well. |
jocko 8-Nov-2010 [1576] | With this version, all the inputs and outputs are files. I'm waiting for more specs before loading directly into memory. It's possible to convert many file formats (including tiff) into may others. |
Oldes 8-Nov-2010 [1577] | hm.. but I don't see ImageMagickObject.dll in my Imagick folder. |
older newer | first last |