You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by David Carter <ap...@entertain-me.com> on 2008/02/13 22:04:04 UTC

Returning large objects from a user implemented hook

Hi,

I'm trying to implement a hook in a module I'm developing that will
allow languages such as PHP to access it. Part of the information I need
to pass back will be in the form of 64 byte data blocks. As I see it,
these are my options:

1. Return the block as the return value. Compiler complains, as it
should.
2. Pass in a pointer to memory that will contain the data. This
segfaults.
3. Allocate memory and return a pointer. Wouldn't this segfault as well?
4. ???

Suggestions?

Not all of life fits in an integer :)

TIA,
Dave



Re: Returning large objects from a user implemented hook

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 13 Feb 2008 16:04:04 -0500
David Carter <ap...@entertain-me.com> wrote:

> 2. Pass in a pointer to memory that will contain the data. This
> segfaults.

The method is fine, but you have a bug.

> 3. Allocate memory and return a pointer. Wouldn't this segfault as
> well?

That's fine too.  Only you can say which method is more efficient.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/