If I call saveFile before dlclose, the file is changed as expected, but if I call saveFile *after* dlclose, the file is not changed.
This is part of a bigger program, and I need to call dlclose before saving the file.
Here's the caller of the shared library:
Code: Select all
void* lhandle = dlopen("./libpreprocess.so", RTLD_NOW);
if (lhandle) {
typedef void (*processDataset)(DcmFileFormat *);
processDataset lprocessDset = (processDataset) dlsym(lhandle, "processDataset");
if (!lprocessDset) {
DCMQRDB_INFO("Cannot load symbol 'processDataset': " << dlerror());
dlclose(lhandle);
return;
}
lprocessDset(ff);
}
dlclose(lhandle);
ff->saveFile("output.dcm");
Code: Select all
extern "C" {
void processDataset(DcmFileFormat * ff)
{
OFString lPatientName;
DcmDataset * dataset = ff->getDataset();
dataset->putAndInsertOFStringArray(DCM_PatientsName, "NEW VALUE");
}
}