diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2000-05-19 21:44:11 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2000-05-19 21:44:11 +0000 |
commit | 3556e2757c480d41b6435b8dfa685c04fd02e225 (patch) | |
tree | ac1579a1b6a67dfc5bb33dfe6c0e58a8672e6a00 /docs/non_apr_programs | |
parent | 7ed61459129217b90b30ca3bcc81696b5314105f (diff) | |
download | libapr-3556e2757c480d41b6435b8dfa685c04fd02e225.tar.gz |
Add two APR docs. The first talks about why we are using incomplete
types. The second talks about using APR'ized programs with non-APR'ized
programs.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60071 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/non_apr_programs')
-rw-r--r-- | docs/non_apr_programs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/non_apr_programs b/docs/non_apr_programs new file mode 100644 index 000000000..47b7d8ec6 --- /dev/null +++ b/docs/non_apr_programs @@ -0,0 +1,47 @@ +How do I use APR'ized programs in connection with programs that don't +use APR? These darn incomplete types don't let me fill out the APR types. + +The APR developers acknowledge that most programs are not using APR, and +we don't expect them to migrate to using APR just because APR has been +released. So, we have provided a way for non-APR'ized programs to interact +very cleanly with APR. + +There are a set of programs, all documented in apr_portable.h, which allow +a programmer to either get a native type from an APR type, or to setup an +APR type from a native type. + +For example, if you are writing an add-on to another program that does not use +APR for file I/O, but you (in your infinite wisdom) want to use APR to make +sure your section is portable. Assume the program provides a type foo_t with +a file descriptor in it (fd). + +void function_using_apr(foo_t non_apr_struct, ap_pool_t *p) +{ + ap_file_t *apr_file = NULL; + + ap_put_os_file(&apr_file, &non_apr_struct->fd, p); + + ... +} + +There are portable functions for each APR incomplete type. They are all +called ap_put_os_foobar(), and they each take the same basic arguments, a +pointer to a pointer to the incomplete type (the last pointer in that list +should be NULL), a pointer to the native type, and a pool. Each of these can +be found in apr_portable.h. + +If you have to do the exact opposite (take an APR type and convert it to a +native type, there are functions for that too. For example: + +void function_not_using_apr(apr_file_t *apr_file) +{ + int unix_file_desc; + + ap_get_os_file(&unix_file_desc, apr_file); + + ... +} + +For each ap_put_os_foobar, there is a corresponding ap_get_os_file. These are +also documented in apr_portable.h. + |