[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:20:15 UTC 2010


On 25 September 2010 21:14, Igor Stasenko <siguctua at gmail.com> wrote:
> On 25 September 2010 21:08, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>
>>
>> On 25.09.2010, at 16:27, Igor Stasenko wrote:
>>
>>>
>>> On 25 September 2010 15:02, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>>>
>>>> On 25.09.2010, at 03:14, Igor Stasenko wrote:
>>>>>
>>>>> Is there alias of some sort, which identifies standard C library?
>>>>
>>>> Yes: ''
>>>>
>>> It actually identified main module (or global symbol space, if you want).
>>> But it doesn't works :(
>>
>> It used to work. Guess we need to fix it?
>>
>
> I could even attempt to do that, if someone could tell me, how to
> enable dprintf()
> to print, what is happening inside sqNamedPrims.c
> and sqUnixExternalPrims.c
> so, i can see it.
>
>

Oh, it seems trivial :)

/* ioLoadSymbolOfLengthFromModule
	This entry point is exclusively for the FFI.
*/
void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt
functionNameLength, void *moduleHandle)
{
	char *functionNamePointer= pointerForOop((usqInt)functionNameIndex);
	char functionName[256];
	sqInt i;

	if(functionNameLength > 255)
		return 0; /* can't cope with those */
	for(i=0; i< functionNameLength; i++)
		functionName[i] = functionNamePointer[i];
	functionName[functionNameLength] = 0;
	if(moduleHandle)
		return ioFindExternalFunctionIn(functionName, moduleHandle);
	else
		return 0;
}

So, i suggest to remove if(moduleHandle), and modify platform-specific
code to handle the null handle value.

-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list