Drobe :: The archives
About Drobe | Contact | RSS | Twitter | Tech docs | Downloads | BBC Micro

Inside an unofficial Shared C Library

By Chris Williams. Published: 20th Mar 2006, 23:51:42 | Permalink | Printable

Open sourcing RISC OS by stealth

Screenshot of the alternative SCL in actionOf the 344 functions in the Castle Shared C Library, Graham Shaw has so far managed to implement 200 in his alternative module. A hundred of those have been fully tested, and this is after six weeks of development. When applications use his project's module, it prints a little banner to remind Graham that the program is using his unofficial SCL, although this will be disabled in the eventual public release.

By Graham's reckoning, his target is to recreate the official SCL's 48 base functions, 185 C library functions, and 111 functions related to 64bit support, the C99 standard and other bits and pieces.

The module is an open source affair, but will allow applications to use it without repercussions, such as requiring proprietary program authors to reveal their own source code. Developers can, it's expected, choose to use their own choice of 'stubs' library, as provided by the Castle C/C++ compiler kit, RISCOS Ltd's StubsG or with the GCCSDK.

He explained: "The library will be licensed under the GNU GPL, version 2 or later, with the libgcc exception, plus a formal statement explaining how I believe it should be applied to a RISC OS module."

It was anticipated that Graham, the man behind RiscPkg, would re-use source code from other projects, such as Unixlib, to craft his own SCL. However he said: "I'm keeping my options open. I have nothing against using other code, it just hasn't been worthwhile so far.

"So far all of the code has been written from scratch. This is because the SCL needs to meet quite a few requirements above and beyond ISO C compliance if it is to be fully compatible. For example, streams are partly implemented by macros, so they must be implemented in a very specific way.

"Also, although I have patched GCC so that it is usable within the SCL, there are parts of the language which aren't supported and would require substantial effort to fix. You can't, for example, use string literals because they are not relocated correctly. This is a significant barrier to the re-use of existing code."

On how long it will take to finish, he added: "To use a Debianism, it will be released when it's ready.

"This isn't a module you want to install on your computer in a half-baked state."

The development of an alternative Shared C Library by Graham Shaw opens many possible avenues of future development. It reminds us how modular RISC OS is, and how it's the sum of some 150 individual components - most of which can be swapped out and replaced, within reason.

While some modules do complex work, such as the Font Manager, others can be produced from scratch or through code re-use. For example, the MessageTrans module, of which a replacement is rumoured to be floating around, could be produced from scratch to replace the one supplied by the operating system.

This patchwork approach to introducing, bit by bit, an open source RISC OS by stealth can be criticised for perhaps introducing a degree of instability into the system by relying on software produced by different groups of programmers most likely working in their spare time - the headache for users juggling different variants and version numbers will not be insignificant.

On the other hand, it could lend a hand in updating components of the operating system that have been left untouched for too long. The debate isn't about to end any time soon.


Alternative Shared C Library in development Comments?

Previous: Alternative Shared C Library in development
Next: News in brief


Viewing threaded comments | View comments unthreaded, listed by date | Skip to the end

One of the things that has long niggled me with the SCL is that floating point errors are not handled conveniently. On other platforms, with pre-emptive multitasking, the error signals can be picked up and C source code does not have to wrap its arithmetic inside error trapping. Can Graham do anything about this? I do not want to pester him with vague queries when he is busy doing valuable work, but maybe he will recognize the problem that I am fumbling to express.

 is a RISC OS UserGavinWraith on 21/3/06 8:44AM
[ Reply | Permalink | Report ]

It's a shame it's not released under something less restrictive than GPL. That way the pressure could have been put on RISC OS Ltd and Castle to adpot the "third way" and use this open Shared C Library, and we'd be back to having one SCL for all. Whether or not they would have done so is, of course, a different matter.

 is a RISC OS Usercmj on 21/3/06 9:38AM
[ Reply | Permalink | Report ]

In reply to GavinWraith:

Sounds feasible, but it might cause compatibility problems with existing software so I would want to tread cautiously.

(There is the possibility of making this sort of behaviour optional - either controlled globally or on a per-program basic - in much the same way as some of the features provided by UnixLib.)

A related question is whether to use the FPE or soft floating point. (Initially I'm going for the FPE, but a floating point library could be incorporated later.)

 is a RISC OS Usergdshaw on 21/3/06 9:50AM
[ Reply | Permalink | Report ]

In reply to cmj:

The licence only specifies what you can do without asking the author beforehand.

Having said that I doubt my module would integrate very well with the way RISC OS is built, not to mention any political or support issues.

 is a RISC OS Usergdshaw on 21/3/06 10:06AM
[ Reply | Permalink | Report ]

cmj: Under the GPL, RISC OS Ltd, Castle (and everyone else on the planet) would be free to use, distribute, bundle with machines, include in ROMs and modify the code. Their only obligation is that they must provide the source to modified versions that they distribute. Given Graham's version would pretty much solve their compatability issues that's not a lot to ask in return. Note: this is because of the extra exemptions of the libgcc clause, that effectively negate the 'viral' aspects of the GPL that buisnesses generally have a problem with.

In otherwords, feel free to pressure ROL and Castle to use this version.

 is a RISC OS Userflibble on 21/3/06 11:26AM
[ Reply | Permalink | Report ]

In any case, as Graham points out, it only imposes conditions on what they can do without asking him (as would the plain GPL). Because he developed it from scratch without using any code from elsewhere he's got full control over it, so there's nothing to prevent him releasing it separately to any individual or company under a completely different license if he wishes to.

 is a RISC OS UserSimonC on 21/3/06 11:41AM
[ Reply | Permalink | Report ]

Will such open source modules, intended as 'drop-in' replacements for parts of RISC OS, be able to avoid further complicating the problems with conflicting version numbers that we've seen when (e.g.) ROL and Castle each make separate releases of the 'same' component with their own numbering schemes?

 is a RISC OS Userchrisrayson on 21/3/06 4:12PM
[ Reply | Permalink | Report ]

In reply to chrisrayson:

I can avoid making the problem any worse. My intention is to match the version number of the most recent ROL or CTL module which which I believe mine to be fully compatible, and then provide further details of exactly what is loaded in the comment field.

I'm not so sure what to do in response to the function _clib_version. Does anyone use this, and if so do they interpret it programmatically?

 is a RISC OS Usergdshaw on 21/3/06 5:41PM
[ Reply | Permalink | Report ]

Please login before posting a comment. Use the form on the right to do so or create a free account.

Search the archives

Today's featured article

  • Copying vinyl to CDs
    Play it again, Sam
     10 comments, latest by Heathcliffe on 15/2/06 9:49AM. Published: 11 Feb 2006

  • Random article

  • Qercus reviewed but renewed?
    Forty months after taking out an annual subscription, Martin Hansen ponders whether or not to continue his Qercus sub
     28 comments, latest by hzn on 3/8/07 4:15PM. Published: 27 Jul 2007

  • Useful links

    News and media:

    Top developers:
    RISCOS LtdRISC OS OpenMW SoftwareR-CompAdvantage SixVirtualAcorn

    CJE MicrosAPDLCastlea4X-AmpleLiquid SiliconWebmonster


    RISCOS.org.ukRISCOS.orgRISCOS.infoFilebaseChris Why's Acorn/RISC OS collectionNetSurf

    Non-RISC OS:
    The RegisterThe InquirerApple InsiderBBC NewsSky NewsGoogle Newsxkcddiodesign

    © 1999-2009 The Drobe Team. Some rights reserved, click here for more information
    Powered by MiniDrobeCMS, based on J4U | Statistics
    "Please give the Castle bashing a break... please!"
    Page generated in 0.1226 seconds.