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

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

Andreas
29-Jan-2010
[634x2]
If you add a capability to ship multiple libraries easily, that would 
be great as well
I.e. that i can ship linux, windows and osx extensions along with 
a simple script, and use the proper extension on the proper platform
BrianH
29-Jan-2010
[636]
Universal Binaries or some such?
Andreas
29-Jan-2010
[637x2]
nope, just simple namespacing issues
if all three extensions ought to be called foo.rx, shipping them 
side by side will be tough :)
BrianH
29-Jan-2010
[639]
There are many platforms that use incompatible .so or .dll files, 
so a packaging/installer format would be good.
Andreas
29-Jan-2010
[640x3]
yes
the nice thing about my patch: it would enable linux extensions _right 
now_
letting people play with them
BrianH
29-Jan-2010
[643]
We aren't just supporting 3 platforms.
Andreas
29-Jan-2010
[644x2]
currently you the hostkit supports only 2
i like small, incremental changes
BrianH
29-Jan-2010
[646]
No, it wouldn't because LOAD-EXTENSION doesn't work on Linux yet.
Andreas
29-Jan-2010
[647]
load extension works great on linux
BrianH
29-Jan-2010
[648]
Check if it works with .rx named files, I'm curious.
Andreas
29-Jan-2010
[649x4]
$ file ext/sample.so 

ext/sample.so: ELF 32-bit LSB shared object, Intel 80386, version 
1 (SYSV), dynamically linked, not stripped
that's the sample extension from the R3 extension zip released some 
months back
$ ./r3 -sq
System object protected
>> append system/options/file-types [%.so extension]

== [%.bmp bmp %.gif gif %.png png %.jpg %.jpeg jpeg %.dll extension 
%.so extension]

>> import %ext/sample.so
>> add-mul 10 20 30
== 900
and that's a hostkit compiled with my posix loading patch
BrianH
29-Jan-2010
[653]
And have you tested by adding .so to system/options/file-types at 
runtime and then using IMPORT on an extension?
Andreas
29-Jan-2010
[654]
...
BrianH
29-Jan-2010
[655]
Never mind, it was an AltME delay.
Andreas
29-Jan-2010
[656x4]
thought so :)
>> append system/options/file-types [%.rx extension]

== [%.bmp bmp %.gif gif %.png png %.jpg %.jpeg jpeg %.dll extension 
%.rx extension]

>> import %ext/sample.rx
>> add-mul 10 20 30
== 900
works with whatever extension you like
don't get me wrong, i really like the .rx idea
BrianH
29-Jan-2010
[660]
Cool, like Windows. I can make a mezzanine patch for the platform 
file-types that would work for all supported platforms if you like.
Andreas
29-Jan-2010
[661x4]
but this minimal change of adding two lines would get things started 
for now
yes, please
but wouldn't that exactly be what i did in rebdev#6258?
heck, osx is not even supported right now :)
BrianH
29-Jan-2010
[665]
No, it wouldn't be the same. Don't take it personally if I deny that 
submission - it's what started this conversation :)
Andreas
29-Jan-2010
[666x2]
I don't
So you'd get rid of the append in mezz-init.r completely, and add 
the extension filetype some place else?
BrianH
29-Jan-2010
[668x2]
I'd put it there (I think), but it would be different code.
The mezzanine parts of the extension/module model are where I am 
the most familiar with the code :)
Andreas
29-Jan-2010
[670x2]
great
just a quick reminder: on osx .dylib and .so are both ok
BrianH
29-Jan-2010
[672x2]
OK. They're just for convenience though, since every almost dylib 
that is loadable as an extension will have been written specificly 
for that purpose and probably can't be used otherwise, so sticking 
to the .rx filename makes sense.
I'm hoping to prove that wrong with some extensions though.
Andreas
29-Jan-2010
[674x3]
It might be nice to use .rx as "virtual" extension only
then i could have a single script, say foo.r shipped with bar.dll 
bar.so and bar.dynlib, use import %bar.rx in foo.r and it will select 
the proper platform specific library
this will break down as soon as we have e.g. 32b and 64b builds for 
the same platform
BrianH
29-Jan-2010
[677x7]
If LOAD-EXTENSION can be changed to look for .rx first then for .dll 
(or whatever) then this can be seamless. Otherwise it will require 
ugly changes to LOAD. It might be better to make a platform wrapper 
module for your app.
Fortunately the module system is based around importing into the 
system, rather than importing into modules directly. This means that 
you can have all of your platform-specific requirements handled by 
one module or script and then have the rest just reference by module 
name, not file name.
There won't be 32 and 64 bit builds on the same platform, in theory; 
32bit builds get one platform number, 64bit builds another.
We'll see if they mess that up though.
Andreas, what do you think of this code instead?

append system/options/file-types [%.rx extension]
switch fourth system/version [
	3 [append system/options/file-types [%.dll extension]]

 2 [append system/options/file-types [%.dylib extension %.so extension]]
	4 7 [append system/options/file-types [%.so extension]]
]
Whoops, that's a little too verbose.
switch/default fourth system/version [
	3 [append system/options/file-types [%.rx %.dll extension]]

 2 [append system/options/file-types [%.rx %.dylib %.so extension]]
	4 7 [append system/options/file-types [%.rx %.so extension]]
] [append system/options/file-types [%.rx extension]]