/////////////////////////////////////////////////////////////////////// // Function : dsoLoadCallback // Description : This function will be called for each module // Return Value : // Comments : static int dsoLoadCallback(const char *file,void *ud) { void *module = osLoadModule(file); if (module != NULL) { int i; void **userData = (void **) ud; char *name = (char *) userData[0]; char *prototype = (char *) userData[1]; SHADEOP_SPEC *shadeops; { char tmp[OS_MAX_PATH_LENGTH]; sprintf(tmp,"%s_shadeops",name); shadeops = (SHADEOP_SPEC *) osResolve(module,tmp); } if (shadeops != NULL) { for (i=0;; i++) { char *dsoName,*dsoPrototype; if (strcmp(shadeops[i].definition,"") == 0) break; if (dsoParse(shadeops[i].definition,dsoName,dsoPrototype) == TRUE) { if (strcmp(dsoPrototype,prototype) == 0) { dsoInitFunction *init = (dsoInitFunction *) userData[2]; dsoExecFunction *exec = (dsoExecFunction *) userData[3]; dsoCleanupFunction *cleanup = (dsoCleanupFunction *) userData[4]; // Bingo init[0] = (dsoInitFunction) osResolve(module,shadeops[i].init); exec[0] = (dsoExecFunction) osResolve(module,dsoName); cleanup[0] = (dsoCleanupFunction) osResolve(module,shadeops[i].cleanup); if (exec != NULL) { free(dsoName); free(dsoPrototype); // We have found the DSO return FALSE; } } free(dsoName); free(dsoPrototype); } } } osUnloadModule(module); } else { error(CODE_SYSTEM,"Failed to load DSO \"%s\": %s\n",file,osModuleError()); } // Continue iterating return TRUE; }
/////////////////////////////////////////////////////////////////////// // Class : CDLObject // Method : ~CDLObject // Description : /// \brief Dtor // Return Value : - // Comments : CDLObject::~CDLObject() { atomicDecrement(&stats.numGprims); tiniFunction(data); osUnloadModule(handle); }