Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Portable way of finding libc, unbuffered reads
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Sugalski  
View profile  
 More options Jun 21 2003, 3:48 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Sat, 21 Jun 2003 12:55:57 -0400
Local: Sat, Jun 21 2003 12:55 pm
Subject: Re: Portable way of finding libc, unbuffered reads
At 11:55 PM +0200 6/20/03, Jens Rieks wrote:

>  > (Which in itself tickles and scares the bejesus out of me.)  Is there a
>>  good way of finding the standard C library on a Unix system other than
>>  hard-wiring it in like this?
>Yes. Parrot is linked with the standard C library. You can get a handle for
>the own executable by passing a NULL pointer to dlopen. You can also use this
>handle to call libc functions.

That's an interesting trick, albeit a very platform-dependent one. I
can see adding in support for getting a handle on the current
executable (though this is one of the cases where things may behave
differently under the interpreter and as a compiled standalope app)

Given all this, I think that an alternate version of loadlib to open
the current application is in order. (I'd say it should be a library
routine, but since loadlib is already an op it seems in order)
Perhaps loadlib with only one argument should give a handle on the
current app, with callouts to a platform-specific loading routine.
(The dlopen trick won't work on OS X right now, as well as Win32,
since we fake out dlopen)

>You can not pass a NULL pointer to loadlib at the moment, this small hacks
>"converts" an empty string to a NULL pointer to pass it to Parror_dlopen:

I've put in an alternate hack, one that returns NULL from
string_to_cstring if passed in a NULL string pointer.
--
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.