[Lazarus] RE : RE : Dynamic loading of a custom sqlite library
Max Vlasov
max.vlasov at gmail.com
Sun Jun 12 11:40:54 CEST 2011
2011/6/12 Ludo Brands <ludo.brands at free.fr>
>
> > So what did you mean by saying 'dangerous'?
>
> You should have read a little further in the message: "Possibly everything
> is fine for sqlite3 but documenting it as a general solution is IMHO not
> correct.". The scenario I was talking about assumed an initialization
> (before lib2 is loaded) and a finalization routine which would/could run in
> different librarie. This is not the case in your example.
> I proposed to test if the library was loaded before loading again as a
> more general solution to the problem.
> Don't get me wrong. I'm happy this is working for you. I'm only saying it
> is not a good idea to document/promote this as a general solution for
> avoiding problems with double loaded libraries.
>
>
Ludo, ok, I just tried to see the level of the problem you described. I just
recently found this flag so I want to be sure it is working as I expect.
You wrote in your previous post "At the end the unit that used
lib1 could execute some finalization routines. But this time they run in
lib2". I don't see why a function (let's call it somelibrary_somefinalize())
linked with external directive and used somewhere in the sources should be
called from the lib2 this time (if RTLD_DEEPBIND flag is used). For dynamic
loading there's always a variable and this new address was obtained with
dlsym call and this is the only place that aware of
lib2.somelibrary_somefinalize. I may be wrong, but this is how I understood
the logic behind it.
I recently saw that I was wrong assuming that read-only code and data is
safe, because there are usually different versions of libraries so to ensure
imho any symbol should be bind separately.
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110612/d29d52a6/attachment-0003.html>
More information about the Lazarus
mailing list