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

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

Kaj
26-Jan-2011
[2134]
That's true, but it's not tied to the name, Brian tells us
BrianH
26-Jan-2011
[2135]
True. You would use a different file for Linux, though it could also 
be called %zlib.rx :)
Kaj
26-Jan-2011
[2136]
I admit I confuse people by violating this truth and running the 
Linux binary on Syllable :-)
Oldes
26-Jan-2011
[2137]
But than I need zlib.dll and zlib.so in the folder.. and what if 
I don't have zlib.so yet?
Kaj
26-Jan-2011
[2138]
Since they don't work on both OSes, you wouldn't install them both. 
You install the matching one under the same name
BrianH
26-Jan-2011
[2139]
Then don't have zlib.rx in that directory either :)
Oldes
26-Jan-2011
[2140]
What is content of zlib.rx?
BrianH
26-Jan-2011
[2141]
The R3 extension wrapper for ZLib.
Oldes
26-Jan-2011
[2142]
that's the zlib.r3 for me.
BrianH
26-Jan-2011
[2143]
Or the R3 extension that statically links ZLib if you like.
Oldes
26-Jan-2011
[2144]
I don't get it.. I will wait for real life example..I'm fine how 
I have it now.
BrianH
26-Jan-2011
[2145]
In your case you could just rename zlib-rxt.dll to zlib.rx and it 
would work.
Oldes
26-Jan-2011
[2146]
And it will work on Linux?
BrianH
26-Jan-2011
[2147]
You would then import %zlib.rx instead of %zlib.r3. It would work 
on Linux if you made a Linux build of zlib as a R3 extension and 
also called it zlib.rx.
Oldes
26-Jan-2011
[2148x2]
But I want to make clear that the file is DLL, not SO.
maybe I will need my extension on linux later so I will make the 
SO, and I want both in the same directory, not just one, which I 
use at this moment. I want to have my files structure platform independent.
BrianH
26-Jan-2011
[2150]
Why? Don't you put other platforms' extensions in different directories? 
There are multiple platforms that use .dll and .so, remember.
Oldes
26-Jan-2011
[2151]
no... I use same structure.
BrianH
26-Jan-2011
[2152]
And when you install it you don't need to install other platforms, 
just the platform you're on. So you only install the zlib.rx for 
your platform.
Oldes
26-Jan-2011
[2153x4]
I do not install... I just copy folders. the true is, that now it 
can be more complicated as I have also the C sources in the same 
dir.
never mind... this is just a minor detail. Form me is important I 
can decompress zlib data as I could with R2. That's all.
If I had more time, it would be good to try some zlib/gz scheme.. 
but that's not important for me at this moment.
What is more important - can we UNLOAD the extension?
Kaj
26-Jan-2011
[2157]
I thought that was included in R3 now?
BrianH
26-Jan-2011
[2158x2]
You can't unload extensions.
Zlib in R3 doesn't work.
Oldes
26-Jan-2011
[2160]
http://issue.cc/r3/1667
BrianH
26-Jan-2011
[2161]
Kaj, here's an example %rebol.r for your scenario:

REBOL []
use [sys-path] [
sys-path:  %/some/safe/directory/full/of/extensions/
sys/load-module/delay map-each x read sys-path [sys-path/:x]
]
Oldes
26-Jan-2011
[2162]
I have no time to wai for built in zlibt. But for me is every small 
extension a good C exercise
BrianH
26-Jan-2011
[2163]
Then you make sure that your extensions can survive being delayed 
:-/
Kaj
26-Jan-2011
[2164]
How much time and memory do delayed modules take? In any case, it 
will be too much on for example CGI scripts
Pekr
26-Jan-2011
[2165]
BrianH: isn't having just one name going to be a problem for us? 
I like the .rx extension very much. But think about distros. You 
can't have one storage of extensions for various platforms. Dunno 
if such use case would exist. Something like big directory of extensions 
somewhere on the fileshare. In the same path. If the suffixes would 
be different, then those files could co-exist. Hmm, maybe not, because 
.so works for Linux, other Unixes, and those might require different 
extension binary anyway? How would you solve such a case? Subdirs 
per system? e.g. /amiga, /win32, /win64, /linux, /syllable?
BrianH
26-Jan-2011
[2166]
Time: not much. Memory: don't know, platform-specific. They don't 
have their source decoded, but the library is loaded (I think), though 
no code is called except RX_Init (from what I gather). I haven't 
done much work with extensions yet but Carl says they work like that.
Kaj
26-Jan-2011
[2167x2]
Alien binaries shouldn't be installed, so you need separate packages, 
or a package with an extension installer. If you really don't want 
to do that, you need subdirectories
A system-wide loader like that is a feature of an OS that starts 
once, not of a language platform that launches many times
BrianH
26-Jan-2011
[2169x2]
Pekr, the idea behind .rx is to make it possible to write cross-platform 
extensions and have them be called by cross-platform code. If people 
are using extensions then they are expected to be importing them 
before they use them. The .rx convention is one way to do this; platform-specific 
loaders is another. Choose what you prefer.
Subdirs per platform is one way to do this (if you are calling your 
app from a network share, or building it from source for instance).
Kaj
26-Jan-2011
[2171]
So how about import/extension ?
Pekr
26-Jan-2011
[2172]
BrianH: I fear of the following problem - some user thinkining - 
hah, %sqlite.rx, downloads the extension, but the extension is in 
fact only Windows one :-)
BrianH
26-Jan-2011
[2173x3]
Have them download a zip file containing the Windows binaries. That's 
how SQLite does it.
Kaj: No need. You can import the extensions by filename. We want 
the initial import of an extension to be really clear, distinct from 
the import of a module. If you say that LOAD-EXTENSION looks up the 
file in the system library path, that shoul;d be all the searching 
we would need.
Importing an extension has security implications, so it isn't something 
we want to happen by accident. Make it clear by including the filename.
Kaj
26-Jan-2011
[2176]
Do you acknowledge my concern at all, even after learning that R3 
uses the OS loader?
Pekr
26-Jan-2011
[2177x2]
I would like to get back to Oldes' quesiton - is unloading extension/module/gui 
or other elements technically impossible?
I mean - once I define e.g. layout, objects get defined, and unview 
just hides the window, but the rest is still in the memory without 
any way to be cleared. Is that even solvable? I have no idea of how 
to track all possible references to be unset :-)
Oldes
26-Jan-2011
[2179]
I think it's just not implemented yet... R2 was using FREE to unload 
library.
Pekr
26-Jan-2011
[2180]
(sorry to spoil the extensions group for my question, but it might 
be similar)
BrianH
26-Jan-2011
[2181]
I don't know. I think that extensions are unloaded when the program 
closes.
Pekr
26-Jan-2011
[2182]
Once the program closes is not usefull at all. Think about R3 as 
an OS. It somehow should track resources. And/or stuff like GUI etc. 
should be isoloted in some context which you could easily scrape 
- unset, free, whatever ... or the memory consumption will rise endlesly?
Oldes
26-Jan-2011
[2183]
I don't think we are so far (making R3 OS) :)