Posted to tcl by stevel at Mon Feb 22 02:06:53 GMT 2010view pretty

#ifdef WIN32
    // if the filesystem holding the dll doesn't support direct loading
    // we need to copy it to a temporary directory and load it from there
    //  - critcl2::precopy is defined in critcl/lib/app-critcl/runtime.tcl

    if ((fsPtr = Tcl_FSGetFileSystemForPath(objv[1])) != NULL \
		&& fsPtr->loadFileProc == NULL) {
	int len;
	Tcl_Obj *dirs;
	objv[0] = Tcl_NewStringObj("::critcl2::precopy", -1);
	if ((code = Tcl_EvalObjv(interp, 2, objv, 0)) != TCL_OK) {
	    Tcl_SetErrorCode(interp, "could not preload ",
				      Tcl_GetString(objv[1]), 0);
	    return TCL_ERROR;
	}
	objv[1] = Tcl_GetObjResult(interp);
	Tcl_IncrRefCount(objv[1]);
	dirs = Tcl_FSSplitPath(objv[1], &len);
	preload = (PreloadInfo *) ckalloc(sizeof(PreloadInfo));
	preload->dir = Tcl_FSJoinPath(dirs, --len);
	Tcl_IncrRefCount(preload->dir);
    }
#endif