help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview] Reference for unit 'dynpwu' (#powtils_main)

Reference for unit 'dynpwu'

uses

  pwuErrors,

  pwuTypes;

Notes

Use this unit as a replacement for pwumain when you wish to use the dynamic link library. Dynpwu is meant to be a replica of pwumain, but instead of compiling all the functions into your executable, they are stored in a library.

Please see the pwumain docs for information on each function. There is no documentation for each dynpwu function since they are exactly the same as pwumain functions.

Dynamic Library Errors

Dynpwu Errors

General information

You must upload the library (i.e. pwu-1.6.0.0.dll) and edit the library path in your config file (pwu_unix or pwu_win) before using dynpwu based cgi programs.

Each download package from source forge usually contains a precompiled DLL. However, if you wish to compile the DLL yourself, navigate into the lib/ directory that you extracted from the zip/gzip file and type 'make' in the lib/ directory.

Library Path In Config file

The pwu_unix or pwu_win config file must contain the path to the library on the first line, with a pound (hash) sign in front with no spaces.
#/path/library.so 
Examples of typical paths on line 1 of your config file are below.
Relative path:
  #../../pwu/pwu-1.6.0.0.so
  
Absolute path:
  #/home/yourname/cgi-bin/pwu/pwu-1.6.0.0.so
  
Special server independent path inside public html (1.6.0.1 only):
  #$DOCROOT/pwu/pwu-1.6.0.1.so
  
Similar to above, but hidden from the public (not inside public_html/):
  #$DOCROOT/../pwu/pwu-1.6.0.1.so
  

Docroot Macro in Path

If you use the DOCROOT macro, then the cgi program will find out your server document root path by requesting that environment variable. This environment variable is not available when you run your program from the command line, as the server environment variables are only invoked when you request using a web browser.

Be warned that using $DOCROOT means the library won't be found when using the command line to test your cgi programs.

The DOCROOT macro is not available in version 1.5 or 1.6.0.0 and was only introduced in 1.6.0.1 and higher versions.

The DOCROOT macro is a good practice to use if you are tired of changing your relative paths each time you upload a program to some subdirectory in cgi-bin that is no longer correctly relative. It is also useful if you switch web servers and your absolute paths are changed.

The document root references your htdocs or html directory, not your CGI-BIN directory. Examples on typical servers of where DOCUMENT ROOT is located:

  public_html/
  www/
  htdocs/
  C:\program files\apache group\htdocs\
You might be thinking that it would be better to store the library in a cgi bin directory so that it is hidden from the public. You can do that by relatively referencing where your cgi-bin is to document root.

Example, one directory back from public html:

  #$DOCROOT/../cgi-bin/libs/pwu-1.6.0.1.so
Or if cgi bin is located in your public html:
  #$DOCROOT/cgi-bin/libs/pwu-1.6.0.1.so

The other option you have is to upload your library to a system directory, but system directories can become black holes with lots of forgotten files in them.






lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505