I am busy coding a dll that supplies several functions to a host application. This application calls the dll dynamically, loading and freeing it after every function call.
I have no control over the host app. I can only work with within the dll. Is there a way I can keep certain variables in memory so that I can reuse them within each function? Obviously a global varable gets cleared when the dll is unloaded by the host app. Saving the dll to file sounds very messy!
Can anyone suggest a way of assigning a variable that i can keep global?
Thanks
I think you have 2 main options here.
offer 2 versions of your function, the one you have now, plus another where they pass in a buffer (record, whatever) that you can read previous state from, and of course update the state into. Call this the high perf version of the function. They will want to use it.
Save the state like you would a cookie (thats basically what it is) in a file somewhere.
Option 1 would require modification to the host app, but would be compelling for the host app developers to take advantage of, Option 2 would require no changes to the host app, but would not be as performant.
I would not personally be inclined to start mucking about with the reference count, presumably the host app is unloading for a reason, if I was the host app dev, that would annoy me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With