[Vm-dev] Call to Unix experts: how i can obtain a pointers to mmap/dlopen/dlsym functions?

Igor Stasenko siguctua at gmail.com
Sat Sep 25 18:01:59 UTC 2010

On 25 September 2010 20:36, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> On Sat, Sep 25, 2010 at 10:31 AM, Igor Stasenko <siguctua at gmail.com> wrote:
>> On 25 September 2010 20:17, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> >
>> >
>> >
>> > On Unix systems using dlopen et al that's dlsym(RTLD_DEFAULT,symbolname).  I don't know what the equivalent, if any, there is on Windows.
>> >
>> On Windows i'm using crtdll.dll , which is C-run-time dymanically
>> loadable library.
>> And unless VM compiled using different compiler (not GNU one), i am
>> pretty sure that this name will remain same.
>> And there is no 'global symbol namespace' concept in windows. You
>> always should supply a distinct module handle (be it dll, or
>> process module).
> So what should the abstraction be?
> - a global space implemented directly by dlsym(RTLD_DEFAULT,...) on Unix and synthesized by enumerating al loaded modules on Windows

I'm not sure if its necessary for Windows. i'm not missing such
functionality on Windows.
Moreover, i can always implement it in image, because Kernel32.dll is
always Kernel32.dll, and it is the place where
i can find loadLibrary() and getProcAddres() and many other functions,
like enum loaded modules etc, so i can discover all info i need
about running environment. So, the absence of global symbol namespace
on Windows its not an issue as to me.

In constrast, on Unix, a dlsym(RTLD_DEFAULT,...) seems like the only
way how you can hook-in into running environment for
introspection purposes.
So, i think we could leave things as it is, except modify linux version of

 void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt
functionNameLength, void *moduleHandle)

to accept null moduleHandle so, then it will lookup the symbol from
global namespace.

> - provide a primitive that enumerates the loaded library names (using the standard lookup prims to search them)?

Yes, that's would be userful.
One really needs to know, what libraries is already loaded in order to
avoid attempts to load different version(s) of them.

>> --
>> Best regards,
>> Igor Stasenko AKA sig.

Best regards,
Igor Stasenko AKA sig.

More information about the Vm-dev mailing list