gap icon indicating copy to clipboard operation
gap copied to clipboard

libgap: add a clean way to disable loading `init.g` (i.e. set `SyLoadSystemInitFile` to 0)

Open fingolfin opened this issue 10 months ago • 0 comments

This is needed by GAP.jl (which currently does it by "manually" poking 0 into SyLoadSystemInitFile), and also logically makes sense.

One way would be to add an argument BOOL dontLoadInitFile or so to GAP_Initialize (or its reverse).

Another would be to split this out from GAP_Initialize completely, i.e. GAP_Initialize never loads init.g, instead a second API is added to do it. That second call would could needed anyway. For reference, GAP.jl handles this part as follows right now:

    if ccall((:READ_GAP_ROOT, libgap), Int64, (Ptr{Cchar},), "lib/init.g") == 0
        error("failed to read lib/init.g")
    end

which is based on what the GAP kernel itself does right now:

    if ( SyLoadSystemInitFile ) {
      GAP_TRY {
        if ( READ_GAP_ROOT("lib/init.g") == 0 ) {
                Pr( "gap: hmm, I cannot find 'lib/init.g' maybe"
                    " use option '-l <gaproot>'?\n", 0, 0);
                SystemErrorCode = 1;
            }
      }
      GAP_CATCH {
          Panic("Caught error at top-most level, probably quit from "
                "library loading");
      }
    }

I intend to eventually work on this, but for now have other priorities, so I am putting this here to (a) not forget, and (b) just in case someone else is interested in tackling this.

fingolfin avatar Jan 03 '25 09:01 fingolfin