Bonjour ! J'ai transformé un programme C en extension Tcl. Cette extension apparemment marche, mais lorsque je l'execute plusieurs fois, Tcl crashe. Si j'enleve l'extension et passe par un "exec" du programme C, tout va bien. Il y a donc un pb avec cette extension. Selon Valgrind, mon extension a quelques problèmes de libération de mémoire (sqlite3 et Tcl aussi par ailleurs !!). En Tcl: set toto [list \ [list nom1 1.0 5.2 3.1] \ [list nom2 0.1 15.1 0.1] \ ... ] MyFonc $toto -wc ... En C: int MyFoncObjCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { int nbIndividus; individu **ind; Tcl_Obj **OInd; if (Tcl_ListObjGetElements(interp,objv[1],&nbIndividus,&OInd) != TCL_OK) { return TCL_ERROR; } //-> Puis-je passer directement objv[1] ? Traitement(interp, OInd, nbIndividus, &nbDim, &ind); ... return TCL_OK; } static void Traitement(Tcl_Interp *interp, Tcl_Obj **OLinePtr, int nb, int *nbDim, individu ***ind) { int i,j,nbCol; char *nomIndividu; Tcl_Obj **OPtr; //recupere nb dimensions if (Tcl_ListObjLength(interp, OInd[0], &nbCol) != TCL_OK) { return TCL_ERROR; } *nbDim = nbCol-1; *ind = (individu **)ckalloc(sizeof(individu *)*nb); for (i==0;iId=i; (*ind)[i]->val=(double *)ckalloc(sizeof(double)*(*nbDim)); for(j=0;jnom = (char *)ckalloc(sizeof(char)*lgt); strcpy((*ind)[i]->nom,nomIndividu); } else { Tcl_GetDoubleFromObj(interp, OPtr[j], &((*ind)[i]->val[j-1])); } }