Open rebolbot opened 14 years ago
Submitted by: BrianH
Implemented in mezz-init.r 6763.
Submitted by: pekr
There might be imo a psychological problem for users. When they will see .rx, they will think they can just copy it over to another platform, as well as they can do with .r scripts, which are cross-platform. But that is not case with Extensions imo, which are always platform specific dlls. Or am I wrong?
Submitted by: abolka
> haven't checked OS X yet
using shared libs with a .rx extension should work fine on osx, osx (10.3+) is just posix in this regard.
Submitted by: BrianH
Pekr, that's a good point. The platform-specific nature of compiled extensions should be noted in the docs. You would have the same psychological problem with .so extensions, which are just as platform-specific, or .dylib extensions that may be PPC, Intel, ARM, 32bit or 64bit, or some mix of them in a Universal Binary. Even .dll extensions could be 32 or 64bit x86 or even ARM, on Windows, WinCE, OS/2 or extended DOS.
Submitted by: BrianH
On alpha 108, the Windows build, %.rx and %.dll are both registered as filetypes of 'extension. We will see what other platform builds register.
Submitted by: abolka
Actually, this has been fixed in A97: .rx, .dll on Windows; .rx, .dylib, .so on OSX; .rx, .so on Linux and FreeBSD (and OpenBSD, I assume).
Submitted by: BrianH
Thanks, Andreas. "Fixed in" changed accordingly.
Submitted by: BrianH
Extensions in R3 are very good for wrapping platform-specific code and making APIs and using them from platform-neutral REBOL code, except for one thing: the name of the file itself. The code that imports the extension with IMPORT or the Needs header has to specify the filename, though only for the initial import if the extension has a module name. This means that otherwise portable code needs one filename changed for every platform it runs on.
A solution to this would be to support a platform-neutral file extension: .rx (meaning Rebol eXtension). The dynamic library used to implement the extension could simply be renamed from .dll or whatever to .rx, and the platform loader could still load it (at least on Windows and posix platforms, haven't checked OS X yet). The platform-specific extensions could also be supported, though would not be recommended.
All that would be required is to register the relevant file extensions in system/options/file-types, probably in mezz-init.r. LOAD would automatically adjust. Only the fallback file types of the current platform should be supported though, so no .so on Windows.
CC - Data [ Version: alpha 96 Type: Wish Platform: All Category: Platform Reproduce: Always Fixed-in:alpha 97 ]