Can't you just store the DLL-handle into the DLLReference structure? --- grischka
From: "egodust" > Heyas, > > When a compiled TCC binary image is memory linked, resolve_sym() is > given the symbol to find, it looks > for the assocated DLL (using DEF file info) and calls LoadLibrary(), > using GetProcAddress() to get the function > pointer. > > This is problematic: > > 1. LoadLibrary() is called, per symbol, if multiple symbols from the > same DLL are used, LoadLibrary() is called > per symbol. > > 2. LoadLibrary() is referenced counted and might overflow for many symbols > > 3. FreeLibrary() is never called, which means the DLLs are not freed, > until process shutdown > > Imagine an application has loaded a custom dll (foo.dll) which TCC > also LoadLibrary()s, the app then FreeLibrary()'s > at some point, but resolve_sym() has messed with the refcnt so the > DLL can't be unloaded until exit(0) > > - > > resolve_sym() should defer loading libraries to another function which > keeps track of the DLLs that have > been LoadLibrary()'d, so that tcc_delete() can free them, it also > means that LoadLibrary() is only called > once per DLL when it needs to be mapped, and other symbols in the same > DLL use the same handle with > GetProcAddress()? > > Kind Regards, > Sam > > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/tinycc-devel