John Porter <[EMAIL PROTECTED]> writes:
>> On Tue, Aug 01, 2000 at 12:01:52AM -0400, John Tobey wrote:
>> >
>> > That's a different problem.  Configure is trying to reverse engineer
>> > header files.  Garrett already knows the prototype of his DLL function
>> > he wants to call, but, unlike Configure, he doesn't have access to a C
>> > compiler.
>
>Hate to say it... well, no, I don't really.
>Wouldn't Tcl be the best example to follow here?

Explain what Tcl did (and which version of Tcl).

I am aware of how Jan added TIFF support to Tcl/Tk:

That approach is:

Declare a huge struct: 

static struct TiffFunctions {
    VOID *handle;
    void (* Close) _ANSI_ARGS_((TIFF *));
    int (* GetField) _ANSI_ARGS_(TCL_VARARGS(TIFF *, tif));
    int (* GetFieldDefaulted) _ANSI_ARGS_(TCL_VARARGS(TIFF *,tif));
    TIFF* (* Open) _ANSI_ARGS_((CONST char*, CONST char*));
...
} tiff = {0};


Declare a list of names: 

static char *symbols[] = {
    "TIFFClose",
    "TIFFGetField",
    "TIFFGetFieldDefaulted",
    "TIFFOpen",
...
    (char *) NULL
};

Load and lookup all the symbols one by one : 

    if (LoadLib(interp, TIFF_LIB_NAME, &tiff.handle, symbols, 10)
            != TCL_OK) {
        return TCL_ERROR;
    }


Call via the struct:

        tif = tiff.Open(tempFileName, "r");

This is horrible - the names are replicated all over the place
It still requires a compiler and seems to have all the worst features
of all the schemes ...



-- 
Nick Ing-Simmons

Reply via email to