You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Havard <br...@kheldar.apana.org.au> on 1999/04/30 18:41:32 UTC

[PATCH] Adding dynamic module loading support for OS/2

I've managed to get dynamic module loading working for OS/2 so here's the 
patch for your review. A few explanatory notes:

- EXE files can't be linked to at run time so a shared core is needed.

- As uninitialized global variables can't be exported I had to add 
initializers to the exported globals that didn't already have one.

- Due to an 'optimization' done for OS/2 v3, DLL file names are limited
to 8 characters plus the .dll extension. As most of the module names are
longer than that I've had to map the module names to a shorter version. This
is done in src/modules/standard/Makefile.OS2. The short version of the module
name must be used in the SharedModule statement in Configuration and in
the LoadModule directive in httpd.conf

- I had to mess with the dependencies in src/Makefile regarding the 
"libhttpd.ep" as I don't want to build one. It _should_ still work for the
sysv people it's meant for but I have no way to check.

- .def files are needed for all DLLs. The one for the core dll is based on the
Win32 one and is called ApacheCoreOS2.def. The .def files for modules are 
generated on the fly by the makefile.


Questions, comments, suggestions etc are all welcome.



Index: ApacheCoreOS2.def
===================================================================
RCS file: ApacheCoreOS2.def
diff -N ApacheCoreOS2.def
--- /dev/null	Fri Apr 30 08:52:01 1999
+++ ApacheCoreOS2.def	Fri Apr 30 08:50:17 1999
@@ -0,0 +1,350 @@
+; ApacheCoreOS2.def : 
+
+LIBRARY libhttpd INITINSTANCE
+DESCRIPTION 'Apache Web Server'
+
+EXPORTS
+	; Add new API calls to the end of this list.
+	ap_MD5Final   @1
+	ap_MD5Init   @2
+	ap_MD5Update   @3
+;	ap_acquire_mutex   @4
+	ap_add_cgi_vars	  @5
+	ap_add_common_vars   @6
+	ap_add_loaded_module   @7
+	ap_add_module   @8
+	ap_add_named_module   @9
+	ap_add_per_dir_conf   @10
+	ap_add_per_url_conf   @11
+	ap_add_version_component   @12
+	ap_allow_options   @13
+	ap_allow_overrides   @14
+	ap_append_arrays   @15
+	ap_array_cat   @16
+	ap_auth_name   @17
+	ap_auth_type   @18
+	ap_basic_http_header   @19
+	ap_bclose   @20
+	ap_bcreate   @21
+	ap_bfilbuf   @22
+	ap_bfileno   @23
+	ap_bflsbuf   @24
+	ap_bflush   @25
+	ap_bgetopt   @26
+	ap_bgets   @27
+	ap_bhalfduplex   @28
+	ap_block_alarms   @29
+	ap_blookc   @30
+	ap_bnonblock   @31
+	ap_bonerror   @32
+	ap_bpushfd   @33
+;	ap_bpushh   @34
+	ap_bputs   @35
+	ap_bread   @36
+	ap_bsetflag   @37
+	ap_bsetopt   @38
+	ap_bskiplf   @39
+	ap_bspawn_child   @40
+	ap_bwrite   @41
+	ap_bytes_in_free_blocks   @42
+	ap_bytes_in_pool   @43
+	ap_call_exec   @44
+	ap_can_exec   @45
+	ap_cfg_closefile   @46
+	ap_cfg_getc   @47
+	ap_cfg_getline   @48
+	ap_chdir_file   @49
+;	ap_check_alarm   @50
+	ap_check_cmd_context   @51
+	ap_checkmask   @52
+	ap_cleanup_for_exec   @53
+	ap_clear_module_list   @54
+	ap_clear_pool   @55
+	ap_clear_table   @56
+	ap_close_piped_log   @57
+	ap_construct_server   @58
+	ap_construct_url   @59
+	ap_content_type_tolower   @60
+	ap_copy_array   @61
+	ap_copy_array_hdr   @62
+	ap_copy_table   @63
+	ap_count_dirs   @64
+	ap_cpystrn   @65
+	ap_create_environment   @66
+;	ap_create_mutex   @67
+	ap_create_per_dir_config   @68
+	ap_custom_response   @69
+	ap_default_port_for_request   @70
+	ap_default_port_for_scheme   @71
+	ap_default_type   @72
+;	ap_destroy_mutex   @73
+	ap_destroy_pool   @74
+	ap_destroy_sub_req   @75
+	ap_die   @76
+	ap_discard_request_body   @77
+	ap_document_root   @78
+	ap_each_byterange   @79
+	ap_error_log2stderr   @80
+	ap_escape_html   @81
+	ap_escape_path_segment   @82
+	ap_escape_quotes   @83
+	ap_escape_shell_cmd   @84
+	ap_exists_scoreboard_image   @85
+	ap_finalize_request_protocol   @86
+	ap_find_command   @87
+	ap_find_command_in_modules   @88
+	ap_find_last_token   @89
+	ap_find_linked_module   @90
+	ap_find_module_name   @91
+	ap_find_path_info   @92
+	ap_find_token   @93
+	ap_get_basic_auth_pw   @94
+	ap_get_client_block   @95
+	ap_get_gmtoff   @96
+	ap_get_limit_req_body   @97
+	ap_get_remote_host   @98
+	ap_get_remote_logname   @99
+	ap_get_server_built   @100
+	ap_get_server_name   @101
+	ap_get_server_port   @102
+	ap_get_server_version   @103
+	ap_get_time   @104
+	ap_get_token   @105
+	ap_getparents   @106
+	ap_getword   @107
+	ap_getword_conf   @108
+	ap_getword_conf_nc   @109
+	ap_getword_nc   @110
+	ap_getword_nulls   @111
+	ap_getword_nulls_nc   @112
+	ap_getword_white   @113
+	ap_getword_white_nc   @114
+	ap_gm_timestr_822   @115
+	ap_gname2id   @116
+	ap_handle_command   @117
+	ap_hard_timeout   @118
+	ap_ht_time   @119
+	ap_ind   @120
+	ap_index_of_response   @121
+	ap_init_virtual_host   @122
+	ap_internal_redirect   @123
+	ap_internal_redirect_handler   @124
+	ap_is_directory   @125
+	ap_is_fnmatch   @126
+	ap_is_initial_req   @127
+	ap_is_matchexp   @128
+	ap_is_url   @129
+	ap_kill_cleanup   @130
+	ap_kill_cleanups_for_fd   @131
+	ap_kill_cleanups_for_socket   @132
+	ap_kill_timeout   @133
+	ap_log_assert   @134
+	ap_log_error_old   @135
+	ap_log_reason   @136
+	ap_log_unixerr   @137
+	ap_make_array   @138
+	ap_make_dirstr   @139
+	ap_make_dirstr_parent   @140
+	ap_make_dirstr_prefix   @141
+	ap_make_full_path   @142
+	ap_make_sub_pool   @143
+	ap_make_table   @144
+	ap_matches_request_vhost   @145
+	ap_md5   @146
+	ap_md5_binary   @147
+	ap_md5contextTo64   @148
+	ap_md5digest   @149
+	ap_meets_conditions   @150
+	ap_no2slash   @151
+	ap_note_auth_failure   @152
+	ap_note_basic_auth_failure   @153
+	ap_note_cleanups_for_fd   @154
+	ap_note_cleanups_for_file   @155
+;	ap_note_cleanups_for_h   @156
+	ap_note_cleanups_for_socket   @157
+	ap_note_digest_auth_failure   @158
+	ap_note_subprocess   @159
+;	ap_open_mutex   @160
+	ap_open_piped_log   @161
+	ap_os_canonical_filename   @162
+	ap_os_escape_path   @163
+	ap_overlap_tables   @164
+	ap_overlay_tables   @165
+	ap_palloc   @166
+	ap_parseHTTPdate   @167
+	ap_parse_hostinfo_components   @168
+	ap_parse_uri   @169
+	ap_parse_uri_components   @170
+	ap_pcalloc   @171
+	ap_pcfg_open_custom   @172
+	ap_pcfg_openfile   @173
+	ap_pclosedir   @174
+	ap_pclosef   @175
+;	ap_pcloseh   @176
+	ap_pclosesocket   @177
+	ap_pduphostent   @178
+	ap_pfclose   @179
+	ap_pfdopen   @180
+	ap_pfopen   @181
+	ap_pgethostbyname   @182
+	ap_popendir   @183
+	ap_popenf   @184
+	ap_pregcomp   @185
+	ap_pregfree   @186
+	ap_pregsub   @187
+	ap_psignature   @188
+	ap_psocket   @189
+	ap_pstrdup   @190
+	ap_pstrndup   @191
+	ap_push_array   @192
+	ap_pvsprintf   @193
+	ap_rationalize_mtime   @194
+	ap_register_cleanup   @195
+;	ap_release_mutex   @196
+	ap_remove_loaded_module   @197
+	ap_remove_module   @198
+	ap_requires   @199
+	ap_reset_timeout   @200
+	ap_rflush   @201
+	ap_rind   @202
+	ap_rputc   @203
+	ap_rputs   @204
+	ap_run_cleanup   @205
+	ap_run_sub_req   @206
+	ap_rwrite   @207
+	ap_satisfies   @208
+	ap_scan_script_header_err   @209
+	ap_scan_script_header_err_buff   @210
+	ap_scan_script_header_err_core   @211
+	ap_send_fb   @212
+	ap_send_fb_length   @213
+	ap_send_fd   @214
+	ap_send_fd_length   @215
+	ap_send_http_header   @216
+	ap_send_http_trace   @217
+	ap_send_mmap   @218
+	ap_send_size   @219
+	ap_server_root_relative   @220
+	ap_set_byterange   @221
+	ap_set_content_length   @222
+	ap_set_etag   @223
+	ap_set_keepalive   @224
+	ap_set_last_modified   @225
+	ap_setup_client_block   @226
+	ap_should_client_block   @227
+	ap_soft_timeout   @228
+	ap_some_auth_required   @229
+	ap_spawn_child   @230
+	ap_srm_command_loop   @231
+	ap_str_tolower   @232
+	ap_strcasecmp_match   @233
+	ap_strcmp_match   @234
+	ap_sub_req_lookup_file   @235
+	ap_sub_req_lookup_uri   @236
+	ap_sync_scoreboard_image   @237
+	ap_table_add   @238
+	ap_table_addn   @239
+	ap_table_get   @240
+	ap_table_merge   @241
+	ap_table_mergen   @242
+	ap_table_set   @243
+	ap_table_setn   @244
+	ap_table_unset   @245
+	ap_tm2sec   @246
+	ap_uname2id   @247
+	ap_unblock_alarms   @248
+	ap_unescape_url   @249
+	ap_unparse_uri_components   @250
+	ap_update_mtime   @251
+	ap_uudecode   @252
+	ap_uuencode   @253
+	ap_vbprintf   @254
+	ap_vformatter   @255
+	ap_vsnprintf   @256
+;	closedir   @257
+;	opendir   @258
+;	os_spawnv   @259
+;	os_spawnve   @260
+;	os_stat   @261
+;	readdir   @262
+	regcomp   @263
+	regexec   @264
+	regfree   @265
+;	access_module @266
+;	alias_module   @267
+	ap_bprintf   @268
+	ap_bvputs   @269
+	ap_day_snames @270  
+	ap_extended_status  @271   
+	ap_limit_section   @272
+	ap_loaded_modules   @273
+	ap_log_error   @274
+	ap_log_printf   @275
+	ap_log_rerror   @276
+	ap_month_snames  @277
+	ap_null_cleanup   @278
+	ap_psprintf   @279
+	ap_pstrcat   @280
+	ap_restart_time  @281 
+	ap_rprintf   @282
+	ap_rvputs   @283
+	ap_scoreboard_image   @284
+	ap_send_header_field   @285
+	ap_server_argv0   @286
+	ap_server_root   @287
+	ap_set_file_slot  @288
+	ap_set_flag_slot   @289
+	ap_set_string_slot  @290
+	ap_set_string_slot_lower  @291 
+	ap_snprintf   @292
+	ap_suexec_enabled  @293 
+	ap_table_do   @294
+	ap_main   @295
+;	asis_module   @296
+;	auth_module   @297
+;	autoindex_module  @298 
+;	cgi_module   @299
+;	config_log_module  @300 
+	core_module   @301
+;	dir_module   @302
+;	env_module   @303
+;	imap_module   @304
+;	includes_module  @305   
+;	mime_module   @306
+;	negotiation_module @307  
+;	os_spawnle   @308
+;	setenvif_module  @309 
+	so_module   @310
+	top_module   @311
+	ap_fnmatch   @312
+	ap_method_number_of   @313
+	ap_exists_config_define   @314
+	ap_single_module_configure   @315
+	ap_make_etag   @317
+	ap_array_pstrcat   @318
+;	ap_os_is_filename_valid   @319
+	ap_find_list_item   @320
+	ap_MD5Encode   @321
+	ap_validate_password   @322
+	ap_size_list_item   @323
+	ap_get_list_item   @324
+	ap_scoreboard_fname   @325
+	ap_pid_fname   @326
+	ap_excess_requests_per_child   @327
+	ap_threads_per_child   @328
+	ap_max_requests_per_child   @329
+	ap_daemons_to_start   @330
+	ap_daemons_min_free   @331
+	ap_daemons_max_free   @332
+	ap_daemons_limit   @333
+	ap_user_name   @334
+	ap_user_id   @335
+	ap_group_id   @336
+	ap_standalone   @337
+	ap_server_confname   @338
+	ap_sub_req_method_uri   @339
+	strcasecmp  @340
+	strncasecmp  @341
+	ap_my_generation  @342
+	ap_dummy_mutex  @343
+	ap_signal  @344
Index: Configure
===================================================================
RCS file: /home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.339
diff -u -r1.339 Configure
--- Configure	1999/04/29 18:48:53	1.339
+++ Configure	1999/04/30 15:50:25
@@ -331,8 +331,8 @@
 	OSDIR="os/os2"
 	DEF_WANTHSREGEX=yes
 	OS='EMX OS/2'
-	CFLAGS="$CFLAGS -DOS2 -Zbsd-signals -Zbin-files -DTCPIPV4 -g"
-	LDFLAGS="$LDFLAGS -Zexe"
+	CFLAGS="$CFLAGS -DOS2 -Zbsd-signals -Zbin-files -Zcrtdll -DTCPIPV4 -g"
+	LDFLAGS="$LDFLAGS -Zexe -Zcrtdll"
 	LIBS="$LIBS -lsocket -lufc -lbsd"
 	DBM_LIB="-lgdbm"
 	SHELL=sh
@@ -942,6 +942,8 @@
     SHLIB_SUFFIX_NAME=so
     SHLIB_SUFFIX_DEPTH=all
     SHLIB_EXPORT_FILES=no
+    SHARED_CORE_EP='lib$(TARGET).ep'
+    SHCORE_IMPLIB=''
     case "$PLAT" in
 	*-linux1)
 	    CFLAGS_SHLIB="-fpic"
@@ -1164,6 +1166,19 @@
 	    LDFLAGS_SHLIB_EXPORT="-Zlink=dynamic -Wl,-Bexport"
 	    CFLAGS_SHLIB='-Zpic'
 	    ;;
+	*-OS/2*)
+	    DEF_SHARED_CORE=yes
+	    LDFLAGS_SHLIB="`echo $LDFLAGS|sed -e s/-Zexe//` -Zdll"
+	    SHLIB_SUFFIX_NAME=dll
+	    SHLIB_SUFFIX_DEPTH=0
+	    LD_SHLIB=$CC
+	    LD_SHCORE_DEF="ApacheCoreOS2.def"
+	    LD_SHCORE_LIBS="$LIBS"
+	    LIBS_SHLIB='$(SRCDIR)/ApacheCoreOS2.a -lsocket'
+	    SHARED_CORE_EP=''
+	    SHCORE_IMPLIB='ApacheCoreOS2.a'
+	    OS_MODULE_INCLUDE='Makefile.OS2'
+	    ;;
 	*)
 	    ##  ok, no known explict support for shared objects
 	    ##  on this platform, but we give not up immediately.
@@ -1521,11 +1536,11 @@
 		modname=`echo $modbase | sed 's/^.*\///' | \
 			sed 's/^mod_//' | sed 's/^lib//' | sed 's/$/_module/'`
 	fi
-	if [ "x$ext" != "xso" ]; then
+	if [ "x$ext" != "x$SHLIB_SUFFIX_NAME" ]; then
 		echo "Module $modname $modbase.$ext" >>$tmpfile
 	fi
 	#   optionally generate export file for some linkers 
-	if [ "x$ext" = "xso" -a "x$SHLIB_EXPORT_FILES" = "xyes" ]; then
+	if [ "x$ext" = "x$SHLIB_SUFFIX_NAME" -a "x$SHLIB_EXPORT_FILES" = "xyes" ]; then
 		echo "$modname" >$modbase.exp
 	fi
 done
@@ -1544,7 +1559,6 @@
 ####################################################################
 ## Now the SHARED_CHAIN stuff
 ##
-LIBS_SHLIB=''
 if [ "x$using_shlib" = "x1" ] ; then
     if [ "x$RULE_SHARED_CHAIN" = "xdefault" ] ; then
 	RULE_SHARED_CHAIN=$DEF_SHARED_CHAIN
@@ -1613,6 +1627,10 @@
     if [ "x$TLDFLAGS_SHLIB_EXPORT" = "x" ]; then
 	echo "LDFLAGS_SHLIB_EXPORT=$LDFLAGS_SHLIB_EXPORT" >> Makefile.config
     fi
+    echo "LD_SHCORE_DEF=$LD_SHCORE_DEF" >> Makefile.config
+    echo "LD_SHCORE_LIBS=$LD_SHCORE_LIBS" >> Makefile.config
+    echo "SHARED_CORE_EP=$SHARED_CORE_EP" >> Makefile.config
+    echo "SHCORE_IMPLIB=$SHCORE_IMPLIB" >> Makefile.config
 fi
 
 ####################################################################
@@ -2001,7 +2019,7 @@
 	ar cr $@ $(OBJS)
 	$(RANLIB) $@
 
-.SUFFIXES: .o .so
+.SUFFIXES: .o .so .dll
 
 .c.o:
 	$(CC) -c $(INCLUDES) $(CFLAGS) $<
@@ -2027,6 +2045,10 @@
 	    && rm Makefile.new
 
 EOF
+	fi
+
+	if [ "x$OS_MODULE_INCLUDE" != "x" ]; then
+		echo "include $OS_MODULE_INCLUDE" >> $moddir/Makefile
 	fi
 
 	$CAT << 'EOF' >> $moddir/Makefile
Index: Makefile.tmpl
===================================================================
RCS file: /home/cvs/apache-1.3/src/Makefile.tmpl,v
retrieving revision 1.110
diff -u -r1.110 Makefile.tmpl
--- Makefile.tmpl	1999/03/16 21:37:02	1.110
+++ Makefile.tmpl	1999/04/30 15:50:25
@@ -14,6 +14,10 @@
 .c.o:
 	$(CC) -c $(INCLUDES) $(CFLAGS) $<
 
+# Used to generate import library for OS/2
+.def.a:
+	emximp -o $@ $<
+
 all: @@Configuration@@ $(TARGET)
 
 @@Configuration@@: Configuration.tmpl
@@ -33,10 +37,10 @@
 target_compile_only: subdirs modules.o
 	$(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c
 
-target_shared: lib$(TARGET).ep
+target_shared: $(SHCORE_IMPLIB) $(SHARED_CORE_EP) lib$(TARGET).$(SHLIB_SUFFIX_NAME)
 	$(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \
 	      -o $(TARGET) -DSHARED_CORE_BOOTSTRAP main/http_main.c \
-	      ap/libap.a $(LIBS)
+	      ap/libap.a $(LIBS) $(SHCORE_IMPLIB)
 
 lib$(TARGET).ep: lib$(TARGET).$(SHLIB_SUFFIX_NAME)
 	$(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \
@@ -45,7 +49,7 @@
 
 lib$(TARGET).$(SHLIB_SUFFIX_NAME): subdirs modules.o
 	$(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c
-	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o lib$(TARGET).$(SHLIB_SUFFIX_NAME) buildmark.o $(OBJS) $(REGLIB)
+	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o lib$(TARGET).$(SHLIB_SUFFIX_NAME) buildmark.o $(OBJS) $(REGLIB) $(LD_SHCORE_DEF) $(LD_SHCORE_LIBS)
 	@if [ ".$(SHLIB_SUFFIX_LIST)" != . ]; then \
 		rm -f lib$(TARGET).$(SHLIB_SUFFIX_NAME).*; \
 		for suffix in $(SHLIB_SUFFIX_LIST) ""; do \
Index: main/http_config.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_config.c,v
retrieving revision 1.143
diff -u -r1.143 http_config.c
--- http_config.c	1999/03/10 10:34:06	1.143
+++ http_config.c	1999/04/30 15:50:43
@@ -99,7 +99,7 @@
  */
 static int dynamic_modules = 0;
 API_VAR_EXPORT module *top_module = NULL;
-API_VAR_EXPORT module **ap_loaded_modules;
+API_VAR_EXPORT module **ap_loaded_modules=NULL;
 
 typedef int (*handler_func) (request_rec *);
 typedef void *(*dir_maker_func) (pool *, char *);
Index: main/http_main.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.432
diff -u -r1.432 http_main.c
--- http_main.c	1999/04/27 20:36:31	1.432
+++ http_main.c	1999/04/30 15:51:43
@@ -229,26 +229,26 @@
  * for the most part the only code that acts on 'em.  (Hmmm... mod_main.c?)
  */
 
-int ap_standalone;
-uid_t ap_user_id;
-char *ap_user_name;
-gid_t ap_group_id;
+int ap_standalone=0;
+uid_t ap_user_id=0;
+char *ap_user_name=NULL;
+gid_t ap_group_id=0;
 #ifdef MULTIPLE_GROUPS
 gid_t group_id_list[NGROUPS_MAX];
 #endif
-int ap_max_requests_per_child;
-int ap_threads_per_child;
-int ap_excess_requests_per_child;
-char *ap_pid_fname;
-char *ap_scoreboard_fname;
+int ap_max_requests_per_child=0;
+int ap_threads_per_child=0;
+int ap_excess_requests_per_child=0;
+char *ap_pid_fname=NULL;
+char *ap_scoreboard_fname=NULL;
 char *ap_lock_fname;
-char *ap_server_argv0;
+char *ap_server_argv0=NULL;
 struct in_addr ap_bind_address;
-int ap_daemons_to_start;
-int ap_daemons_min_free;
-int ap_daemons_max_free;
-int ap_daemons_limit;
-time_t ap_restart_time;
+int ap_daemons_to_start=0;
+int ap_daemons_min_free=0;
+int ap_daemons_max_free=0;
+int ap_daemons_limit=0;
+time_t ap_restart_time=0;
 int ap_suexec_enabled = 0;
 int ap_listenbacklog;
 int ap_dump_settings = 0;
@@ -281,8 +281,8 @@
 listen_rec *ap_listeners;
 static listen_rec *head_listener;
 
-API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN];
-char ap_server_confname[MAX_STRING_LEN];
+API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN]="";
+char ap_server_confname[MAX_STRING_LEN]="";
 char ap_coredump_dir[MAX_STRING_LEN];
 
 array_header *ap_server_pre_read_config;
@@ -2651,7 +2651,7 @@
 static int volatile shutdown_pending;
 static int volatile restart_pending;
 static int volatile is_graceful;
-ap_generation_t volatile ap_my_generation;
+ap_generation_t volatile ap_my_generation=0;
 
 #ifdef WIN32
 /*
@@ -6354,6 +6354,18 @@
 #endif /* ndef SHARED_CORE_TIESTATIC */
 #else  /* ndef SHARED_CORE_BOOTSTRAP */
 
+#ifdef OS2
+/* Shared core loader for OS/2 */
+
+int ap_main(int argc, char *argv[]); /* Load time linked from libhttpd.dll */
+
+int main(int argc, char *argv[])
+{
+    return ap_main(argc, argv);
+}
+
+#else
+
 /*
 **  Standalone Bootstrap Program for Shared Core support
 **
@@ -6475,6 +6487,7 @@
 	return 0;
 }
 
+#endif /* def OS2 */
 #endif /* ndef SHARED_CORE_BOOTSTRAP */
 
 
Index: modules/proxy/.cvsignore
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/.cvsignore,v
retrieving revision 1.5
diff -u -r1.5 .cvsignore
--- .cvsignore	1998/05/10 13:04:34	1.5
+++ .cvsignore	1999/04/30 15:51:57
@@ -8,3 +8,5 @@
 Makefile
 *.lo
 *.so
+*.dll
+*.def
Index: modules/proxy/Makefile.OS2
===================================================================
RCS file: Makefile.OS2
diff -N Makefile.OS2
--- /dev/null	Fri Apr 30 08:52:01 1999
+++ Makefile.OS2	Fri Apr 30 08:51:57 1999
@@ -0,0 +1,6 @@
+# Extra rules for making DLLs for OS/2
+
+%.def : %.c
+	echo "LIBRARY $* INITINSTANCE" > $@
+	echo "EXPORTS" >> $@
+	grep "^module .*=" $< | sed "s/module .* \(.*\) =/	\1/" >> $@
Index: modules/proxy/Makefile.tmpl
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/Makefile.tmpl,v
retrieving revision 1.25
diff -u -r1.25 Makefile.tmpl
--- Makefile.tmpl	1998/09/07 06:59:34	1.25
+++ Makefile.tmpl	1999/04/30 15:51:57
@@ -21,6 +21,9 @@
 	rm -f $@
 	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(OBJS_PIC) $(LIBS_SHLIB)
 
+libproxy.dll: $(OBJS_PIC) mod_proxy.def
+	$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(OBJS_PIC) $(LIBS_SHLIB) mod_proxy.def
+
 .SUFFIXES: .o .lo
 
 .c.o:
Index: modules/standard/.cvsignore
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/.cvsignore,v
retrieving revision 1.2
diff -u -r1.2 .cvsignore
--- .cvsignore	1998/05/10 13:04:35	1.2
+++ .cvsignore	1999/04/30 15:51:57
@@ -1,3 +1,5 @@
 Makefile
 *.lo
 *.so
+*.dll
+*.def
Index: modules/standard/Makefile.OS2
===================================================================
RCS file: Makefile.OS2
diff -N Makefile.OS2
--- /dev/null	Fri Apr 30 08:52:08 1999
+++ Makefile.OS2	Fri Apr 30 08:51:57 1999
@@ -0,0 +1,113 @@
+# Extra rules for making DLLs for OS/2
+
+define mkdll
+$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $* $(<:%.c=%.o) $(LIBS_SHLIB) $(<:%.o=%.def) && \
+emxbind -b -q -s -h1 -d$(<:%.o=%.def) $* && \
+rm $*
+endef
+
+
+%.def : %.c
+	echo "LIBRARY $* INITINSTANCE" > $@
+	echo "EXPORTS" >> $@
+	grep "^module .*=" $< | sed "s/module.* \(.*\) =.*/	\1/" >> $@
+
+access.dll: mod_access.o mod_access.def
+	$(mkdll)
+
+actions.dll: mod_actions.o mod_actions.def
+	$(mkdll)
+
+alias.dll: mod_alias.o mod_alias.def
+	$(mkdll)
+
+asis.dll: mod_asis.o mod_asis.def
+	$(mkdll)
+
+auth.dll: mod_auth.o mod_auth.def
+	$(mkdll)
+
+auth_ano.dll: mod_auth_anon.o mod_auth_anon.def
+	$(mkdll)
+
+auth_db.dll: mod_auth_db.o mod_auth_db.def
+	$(mkdll)
+
+auth_dbm.dll: mod_auth_dbm.o mod_auth_dbm.def
+	$(mkdll)
+
+autoinde.dll: mod_autoindex.o mod_autoindex.def
+	$(mkdll)
+
+cern_met.dll: mod_cern_meta.o mod_cern_meta.def
+	$(mkdll)
+
+cgi.dll: mod_cgi.o mod_cgi.def
+	$(mkdll)
+
+digest.dll: mod_digest.o mod_digest.def
+	$(mkdll)
+
+dir.dll: mod_dir.o mod_dir.def
+	$(mkdll)
+
+env.dll: mod_env.o mod_env.def
+	$(mkdll)
+
+expires.dll: mod_expires.o mod_expires.def
+	$(mkdll)
+
+headers.dll: mod_headers.o mod_headers.def
+	$(mkdll)
+
+imap.dll: mod_imap.o mod_imap.def
+	$(mkdll)
+
+include.dll: mod_include.o mod_include.def
+	$(mkdll)
+
+info.dll: mod_info.o mod_info.def
+	$(mkdll)
+
+log_agen.dll: mod_log_agent.o mod_log_agent.def
+	$(mkdll)
+
+log_conf.dll: mod_log_config.o mod_log_config.def
+	$(mkdll)
+
+log_refe.dll: mod_log_referer.o mod_log_referer.def
+	$(mkdll)
+
+mime.dll: mod_mime.o mod_mime.def
+	$(mkdll)
+
+mime_mag.dll: mod_mime_magic.o mod_mime_magic.def
+	$(mkdll)
+
+negotiat.dll: mod_negotiation.o mod_negotiation.def
+	$(mkdll)
+
+rewrite.dll: mod_rewrite.o mod_rewrite.def
+	$(mkdll)
+
+setenvif.dll: mod_setenvif.o mod_setenvif.def
+	$(mkdll)
+
+so.dll: mod_so.o mod_so.def
+	$(mkdll)
+
+speling.dll: mod_speling.o mod_speling.def
+	$(mkdll)
+
+status.dll: mod_status.o mod_status.def
+	$(mkdll)
+
+uniqueid.dll: mod_unique_id.o mod_unique_id.def
+	$(mkdll)
+
+userdir.dll: mod_userdir.o mod_userdir.def
+	$(mkdll)
+
+usertrac.dll: mod_usertrack.o mod_usertrack.def
+	$(mkdll)
+
Index: modules/standard/mod_so.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_so.c,v
retrieving revision 1.31
diff -u -r1.31 mod_so.c
--- mod_so.c	1999/03/01 15:37:53	1.31
+++ mod_so.c	1999/04/30 15:51:57
@@ -251,7 +251,7 @@
 		       "' in file ", szModuleFile, ": ", ap_os_dso_error(), NULL);
     }
     modi->modp = modp;
-    modp->dynamic_load_handle = modhandle;
+    modp->dynamic_load_handle = (void *)modhandle;
 
     /* 
      * Make sure the found module structure is really a module structure
@@ -291,7 +291,7 @@
 
 static const char *load_file(cmd_parms *cmd, void *dummy, char *filename)
 {
-    void *handle;
+    ap_os_dso_handle_t handle;
     char *file;
 
     file = ap_server_root_relative(cmd->pool, filename);
@@ -307,7 +307,7 @@
     ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL,
 		"loaded file %s", filename);
 
-    ap_register_cleanup(cmd->pool, handle, unload_file, ap_null_cleanup);
+    ap_register_cleanup(cmd->pool, (void *)handle, unload_file, ap_null_cleanup);
 
     return NULL;
 }
Index: os/os2/os.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/os/os2/os.c,v
retrieving revision 1.1
diff -u -r1.1 os.c
--- os.c	1997/11/05 12:48:23	1.1
+++ os.c	1999/04/30 15:51:58
@@ -4,3 +4,57 @@
  */
 
 #include "os.h"
+#define INCL_DOS
+#include <os2.h>
+#include <stdio.h>
+
+static int rc=0;
+
+void ap_os_dso_init(void)
+{
+}
+
+
+
+ap_os_dso_handle_t ap_os_dso_load(const char *module_name)
+{
+    char errorstr[200];
+    HMODULE handle;
+
+    rc = DosLoadModule(errorstr, sizeof(errorstr), module_name, &handle);
+
+    if (rc == 0)
+        return handle;
+
+    return 0;
+}
+
+
+
+void ap_os_dso_unload(ap_os_dso_handle_t handle)
+{
+    DosFreeModule(handle);
+}
+
+
+
+void *ap_os_dso_sym(ap_os_dso_handle_t handle, const char *funcname)
+{
+    PFN func;
+    
+    rc = DosQueryProcAddr( handle, 0, funcname, &func );
+    
+    if (rc == 0)
+        return func;
+
+    return NULL;
+}
+
+
+
+const char *ap_os_dso_error(void)
+{
+    static char message[30];
+    sprintf( message, "OS/2 error code %d", rc );
+    return message;
+}
Index: os/os2/os.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/os/os2/os.h,v
retrieving revision 1.12
diff -u -r1.12 os.h
--- os.h	1999/03/07 13:13:55	1.12
+++ os.h	1999/04/30 15:51:58
@@ -35,4 +35,12 @@
 /* OS/2 doesn't have symlinks so S_ISLNK is always false */
 #define S_ISLNK(m) 0
 
+/* Dynamic loading functions */
+#define     ap_os_dso_handle_t  unsigned long
+void        ap_os_dso_init(void);
+ap_os_dso_handle_t ap_os_dso_load(const char *);
+void        ap_os_dso_unload(ap_os_dso_handle_t);
+void *      ap_os_dso_sym(ap_os_dso_handle_t, const char *);
+const char *ap_os_dso_error(void);
+
 #endif   /* ! APACHE_OS_H */

--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------