Guys, I'm having some problems with my dynamic library module system and I really need some help, please?
What happens is simple, if I load the library, close, load again, close, around the 4th time, it gives me Access Violation and crashes, and I can't figure out why.
It seems that I'm either leaving something behind or deleting something twice, but I just can't find what. And trust me, I looked for 3 days non-stop, this is driving me nuts...
The library sdk can be seen here:
https://github.com/Wusik4000/Wusik_4000_SDK/blob/master/Wusik4000mod.h
So I just create a new module from this using the following code:
https://github.com/Wusik4000/Wusik_4000_SDK/blob/master/Modules/Examples/Gain%20Effect/Source/Gain%20Effect.h
Them, inside the main host, the one that uses all those modules, I just use the code to create a new module: // typedef W4kMod* (*CreateNewModule) (W4kMod::LayerInfo*, W4kMod::GlobalInfo*); // DynamicLibrary dynlib; dynlib.open(thefile); CreateNewModule w4kMod = (CreateNewModule) dynlibMaster.getFunction("createNewModule"); wusikModule = w4kMod(&layerInfo, &globalInfo);
Now, wusikModule holds the actual module dynlib stuff that I use. I use the ScopedPointer for the wusikModule. This works, but as I said, after deleting the module a few times, something bad happens.
If anyone could give me some light on this issue, I would be forever thankful. :-)
Cheers, WilliamK @ Wusik.com