Hi!


I am confused about how the extension loads its sublibs.

libedemo and then MISC extension of libggi does that in different ways.
I don't know, which one is the right one.

libedemo does it in this way:
---------------------------------------------------------------
/* This function is called by LibGGI when the API-list changes */
static int changed(ggi_visual_t vis, int whatchanged)
{
        printf("LibEDEMO: changed(%p, 0x%x) of LibEDEMO called\n",
               vis, whatchanged);

        switch (whatchanged) {
        case GGI_CHG_APILIST: {
                int i;
                const char *fname;
                ggi_dlhandle *lib;
                char api[GGI_MAX_APILEN], args[GGI_MAX_APILEN];

                clearfuncs(LIBGGI_EDEMOEXT(vis));

                for(i=0; ggiGetAPI(vis, i, api, args) == 0; i++) {
                        strcat(api,"-edemo");
                        fname = ggMatchConfig(_edemoConfigHandle, api, NULL);
                        if (fname == NULL) {
                                /* No special implementation for this sublib */
                                continue;
                        }
                        lib = ggiExtensionLoadDL(vis, fname, args, NULL,
                                                 "EDEMOdl_");
                }
        }
        break;
        }

        return 0;
}
---------------------------------------------------------------

... and the MISC extension of libggi in this one:
---------------------------------------------------------------
static int changed(ggi_visual_t vis,int whatchanged)
{
        GGIDPRINT("changed(%p, %i) called for misc extension\n",
                  vis, whatchanged);

        switch (whatchanged) {
                case GGI_CHG_APILIST: {
                        int temp;
                        char api[256],args[256];
                        int err;
                        GGIDPRINT("changed() APILIST \n");

                        clearfuncs(LIBGGI_MISCEXT(vis));
                        for(temp=0; ggiGetAPI(vis,temp,api,args)==0; temp++) {
                                strcat(api, "-misc");
                                GGIDPRINT("Trying #%d: %s(%s)\n",
                                          temp, api, args);
                                err = _ggiAddDL(vis, api, args, NULL,
                                                GGI_DLTYPE_EXTENSION);
                                GGIDPRINT("Loaded #%d: %s(%s) : %d\n",
                                          temp, api, args, err);
                        }
                }
                break;
        }

        return 0;
}
---------------------------------------------------------------


IMHO these ways are slightly different...



Christoph Egger
E-Mail: [EMAIL PROTECTED]

Reply via email to