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
26-Jan-2011
[2228x4]
Having a simple cross-platform way to load those extensions while 
not imposing artificial naming constraints would be _extremely_ useful.
This is what Kaj is proposing, and I couldn't agree more.
The desired mechanism is simple: give an abstract name, have the 
platform-specific extension taken care of automatically, and then 
fall back to the loader.
And this really ought to be part of the "standard" R3 distribution, 
as it will be used widely and we want to be able to rely upon it 
being there.
Maxim
26-Jan-2011
[2232]
I've used a few applications which have their own extension names 
simply because there is a lot of overlap in names and clashing with 
the OS is very easy at some point.
Andreas
26-Jan-2011
[2233]
I use many applications which don't use their own extension names.
Maxim
26-Jan-2011
[2234]
I'd prefer using system names, only not the system load path management. 
  Rebol, should only look for R3 extensions withing its path configs... 
whatever they are... the R3 extensions *will* use the OS loading 
path, which is normal, since the extension is in fact a bridge between 
the OS and rebol.
Andreas
26-Jan-2011
[2235x2]
And name clashes is what a proper loader is there to take care of.
The OS's shared library loader, that is.
Maxim
26-Jan-2011
[2237]
so if a rebol zlib interface is installed, I want the r3 module to 
be loadable using   IMPORT zlib     ... not r3zlib.
Andreas
26-Jan-2011
[2238]
Doesn't necessarily have to be IMPORT. I agree with Brian that we 
probably want to have extension loads "stand out" a bit.
Maxim
26-Jan-2011
[2239x2]
it goes beyond name clashes... R3 extensions have a specific duty, 
we are not loading OS libs directly within R3... import must not 
try to access these.


I would prefer to have a specific loader for extensions something 
like.

EXTEND my-extension
which could allow .rx and platform .so or .dll to match the name.
Andreas
26-Jan-2011
[2241]
But I want to do `import-extension 'zlib` and not:

import switch system/platform/1 [Linux [%zlib.so] Win32 [%zlib.dll] 
...]
Maxim
26-Jan-2011
[2242]
yep we agree.   but I like having .rx also.    its something pretty 
standard on windows to have different names for dlls... the OS itself 
uses different names for various subsystems.
Andreas
26-Jan-2011
[2243x3]
I couldn't care less about .rx.
It's fine if you want to use it, but it makes no difference at all.
Use .rx on Win32, Linux, FreeBSD and whereever you feel like it; 
just don't prescribe its use.
Maxim
26-Jan-2011
[2246]
I'd just leave that up to the developper's  as long as the extension 
loader supports both   :-)
Andreas
26-Jan-2011
[2247x4]
It's not only the developers choice, there are also distributors.
But it's easy enough to have the extension loading mechanism support 
multiple extensions per platform.
That's just a matter of definition.
(I.e. define the order in which multiple extensions are attempted 
and define which extensions are attempted on each platform.)
Maxim
26-Jan-2011
[2251]
my only issue is that the interpreter musn't look for extensions 
in OS paths cause that will invariably lead to library management 
issues.   


many extensions are simply stubs for real OS libs.  furthermore, 
some stray lib could be picked up and cause dangerous side-effects 
when run by the interpreter.


if an R3 os package is built, any extension packages which are built 
for it, should dump the files in R3's own unique search-path setup.
Andreas
26-Jan-2011
[2252x4]
Maxim, R3 does a simple `dlopen`.
It does no "looking" at all.
What happens after that is up to the OS's loader.
Your first sentence above is, for example, simply wrong on almost 
any Unix.
Maxim
26-Jan-2011
[2256x2]
well how do you install zlib.so on a system that already has this 
?
knowing that the zlib.so actually is only a stub for the real one.
Andreas
26-Jan-2011
[2258x3]
Properly manage the loader's search path.
And don't make stupid naming decisions.
You probably don't want to name your extension kernel32.dll or libc.so.
Maxim
26-Jan-2011
[2261]
problem is, I have no clue what names are being used in all the OSes 
out there.  so we end up with having to use crude and ugly prefixes, 
hoping no one else will ever setup the same lib name.
Andreas
26-Jan-2011
[2262x2]
Same difference to hoping that no one will ever use the same library 
suffix.
Those are problems mitigable by many approaches, such as library 
search path management or proper distribution.
Maxim
26-Jan-2011
[2264]
yes, I know... what I want is for R3 to control the lib search path 
not the user ... I'm sure all OSes allow this.  R3 would only load 
extensions in a single place it expects.
Andreas
26-Jan-2011
[2265x4]
That doesn't make sense across platforms.
You probably want and need that on Windows.
You probably don't want and need that on other platforms.
Btw, there are two places where a "user" could control the search 
path. From within R3 or from the outside.
Maxim
26-Jan-2011
[2269x2]
no difference on windows.  they all do the same basic path searching. 
 local and then system paths.
windows actually has a registry of name/version numbers when dlls 
are installed properly, which helps a lot.
Andreas
26-Jan-2011
[2271]
Btw, we already have system/options/module-paths in R3.
Maxim
26-Jan-2011
[2272]
I want to be able to setup a R3 config file that says:

extensions-dir:  %/some/path/


and then R3 will only ever load extensions from there.    the extensions 
can do whatever they want, but we have a controled point of entry 
within REBOL.

afaik, systems allow paths on dlopen.    rebol would simply always 
ask for libs with paths... 


in fact, on windows, that is how you are supposed to do it, probing 
the registry first to get proper paths for libs.
Andreas
26-Jan-2011
[2273]
The "will only ever" is wrong, here.
Maxim
26-Jan-2011
[2274x2]
yeah, I know.   but modules and extensions are very different things.
(my last post refered to system/options/module-paths)
Andreas
26-Jan-2011
[2276x2]
An extension search path should be consulted first, that's what you 
really want to say :)
Even though the practicaly difference will be negligible.