You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ersin ER <er...@cs.hacettepe.edu.tr> on 2005/01/22 12:34:04 UTC

Several questions about apr

Hi all,

For the last several hours I could not compile a sample apr application. 
Could someone please summarize what should I do on a Linux host with a 
tiny demo?

Shall we see a real programmers guide with 1.1 or 2.0 releases? I want 
to write one (at least in my language) but I cannot understand the 
current documentation and I cannot even compile an app :-) If I can make 
progress and if I can have enough overview of the library, I'll start to 
write a guide.

Could someone please summarize the best practices for uses of essential 
modules such as pools?

Thanks.

--- Ersin


Re: Several questions about apr

Posted by Ben Hyde <bh...@pobox.com>.
On Jan 22, 2005, at 1:14 PM, Reid Spencer wrote:
> My "Newbie Question" of this past Thursday has gone unanswered.

That's weird...

Begin forwarded message:

> From: Ben Hyde <bh...@pobox.com>
> Date: January 21, 2005 2:48:10 PM EST
> To: Reid Spencer <re...@x10sys.com>
> Subject: Re: Using APR << Newbie Question
> X-Request-Pgp: 
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x187BD68D
> X-Url: http://enthusiasm.cozy.org/
> X-Face: 
> 8!qM\RM(~j4$R"ON<@7IZWkQHyuZz4"qxdae6*"1py2X$hFj';a/G_AO{Zi-SeiCqT|!wk 
> |U!*'ZW$RJuP7D(H>XRx2:,#_K%g(i]sCz1Vqx#.bF6<JURWXZm'x.rK<"7bd|EGs/~v)r 
> ,_Vp?P%q;f{=]lU=SJOoyO(@XblzxGUqB>Y|-|-(LKuNnD022-zAx8
>
>> Reid "Seriously in need of an APR tutorial" Spencer
>
> You probably aren't unique in that regard :-)
>
> I have an essay about pools around here someplace I really ought to 
> make more public.
>
> Here's a simple example.  Pools are used to provide a very very cheap 
> way to allocate
> memory and an almost zero cost way to reclaim a batch of memory.  So 
> they are used
> to provide scratch storage for activities; when the activity is 
> finished the pool is cleared.
> Or, they are used to provide all the storage for a large data 
> structure and when you want
> to destroy the data structure you just destroy the pool and poof the 
> entire data structure
> is reclaimed.
>
>
>
> #include <stdlib.h>
> #include <apr_pools.h>
> #include <apr_uri.h>
>
> /* Typically routines are handed a pool where they can
>    allocate memory willy nilly, their caller reclaims
>    all that memory from time to time.
> */
>
> static void play_with_uri(apr_pool_t *p)
> {
>   apr_uri_t uri;
>
>   apr_uri_parse(p, "http://example.com/foo.html",&uri);
>   printf(" Scheme: %s\n", uri.scheme);
>   printf(" Unparsed: %s\n", apr_uri_unparse(p, &uri, 0));
> }
>
>
> int main(int argc, char **argv)
> {
>   apr_pool_t *process_pool;   /* You always need one of these :-) */
>
>   apr_initialize();
>   atexit(apr_terminate);
>   apr_pool_create(&process_pool, NULL);   /* No error handling in this 
> program! */
>
>   /* Create temporary pools for transient activities */
>   {
>     apr_pool_t *p;
>     apr_pool_create(&p, process_pool); /* temp pool */
>
>     play_with_uri(p);
>     apr_pool_destroy(p);
>   }
>
>   return 0;
> }
>
>
>
>
>
> ----
> http://enthusiasm.cozy.org/   -- blog
> tel:+1-781-240-2221  -- mobile, et.al.

----
http://enthusiasm.cozy.org/   -- blog
tel:+1-781-240-2221  -- mobile, et.al.


Re: Several questions about apr

Posted by Nick Kew <ni...@webthing.com>.
> I'll even help write the programming guide once I understand things
> better. My "Newbie Question" of this past Thursday has gone unanswered.

Hmmm, I don't remember that.

Apachetutor.org is working towards being a comprehensive set of
programmer documentation.  Contributions are welcome!

>>Could someone please summarize the best practices for uses of essential 
>>modules such as pools?

http://www.apachetutor.org/dev/pools

-- 
Nick Kew

Re: Several questions about apr

Posted by Reid Spencer <re...@x10sys.com>.
I'll second that!

I'll even help write the programming guide once I understand things
better. My "Newbie Question" of this past Thursday has gone unanswered.
We really need some kind of guide for new folks that provides the basic
things needed to get started with APR. 

Reid.

On Sat, 2005-01-22 at 03:34, Ersin ER wrote:
> Hi all,
> 
> For the last several hours I could not compile a sample apr application. 
> Could someone please summarize what should I do on a Linux host with a 
> tiny demo?
> 
> Shall we see a real programmers guide with 1.1 or 2.0 releases? I want 
> to write one (at least in my language) but I cannot understand the 
> current documentation and I cannot even compile an app :-) If I can make 
> progress and if I can have enough overview of the library, I'll start to 
> write a guide.
> 
> Could someone please summarize the best practices for uses of essential 
> modules such as pools?
> 
> Thanks.
> 
> --- Ersin
>