Re: [fpc-devel] library export in Linux
On 05 Oct 2008, at 13:23, Jonas Maebe wrote: On 05 Oct 2008, at 12:59, Felipe Monteiro de Carvalho wrote: On 10/5/08, ABorka [EMAIL PROTECTED] wrote: The problem is only there (checked now on apache 2.2.3 also with the latest svn fpc /11864/ and lazarus /16875/ trunk) if {$ifdef WINDOWS}//!! not needed exports test_module name 'test_module1'; {$endif}//!! not needed Well, then FPC changed, and the old way to export variables on unixes doesn't work anymore. Looks like a regression Previously, all public declarations were automatically exported from libraries under Unix. This was a bug. Now only what appears in the exports section is exported. Variables can however not be renamed in the exports section under Unix (previously they were not allowed in the exports section at all). I've added this to http://wiki.freepascal.org/User_Changes_2.2.2#Exporting_of_library_variables_and_functions Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
On 10/5/08, ABorka [EMAIL PROTECTED] wrote: The problem is only there (checked now on apache 2.2.3 also with the latest svn fpc /11864/ and lazarus /16875/ trunk) if {$ifdef WINDOWS}//!! not needed exports test_module name 'test_module1'; {$endif}//!! not needed Well, then FPC changed, and the old way to export variables on unixes doesn't work anymore. Looks like a regression, but it's not a too big problem. We can just change that in the examples and have less ifdefs. is there. If the ifdef is removed and the exports instruction is there, then apache loads the module without any errors on Linux. Does it also work (instead of only loading) without the ifdef and without you debuging code? If the assignfile is called, it already screws the DefaultHandler execution even if the lines after it are commented out in the procedure. Any suggestion why? I've tried to use streams, same result. wow, this is really strange. I cannot think of a reason why this would happen ... if noone else here has an idea I would ask in a apache mailling list. There may be some reason connected to the internal apache structure. -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
Ok, I go back to my previous idea. Test it with an older apache (specially good would be 2.2.3). -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
Thanks, Jonas. Any suggestion why apache 2.2.8 does not want to load the FPC compiled apache modules (ex: mod_hello.pp in packages/httpd2/examples) on Linux? . .snip . {$define Apache2_2} uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif}; var test_module: module; public name 'test_module'; {*** * Free Pascal only supports exporting variables on Windows ***} {$ifdef WINDOWS} exports test_module name 'test_module'; {$endif} . .snip . begin default_module_ptr := @test_module; FillChar(default_module_ptr^, SizeOf(default_module_ptr^), 0); STANDARD20_MODULE_STUFF(test_module); with test_module do begin name := MODULE_NAME; register_hooks := @RegisterHooks; end; end. does not work (Can't locate API module structure). The length of module_struct (module = module_struct) is correct compared to the C compiled working apache modules. Did these example programs work before fpc supported exports test_module? Jonas Maebe wrote: On 28 Sep 2008, at 10:15, ABorka wrote: Is the exports now supported in Linux or it's a glitch that apache loads the modules with the exports in them? It is now supported, as long as the exports name is the same as the original variable's name. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel Jonas Maebe wrote: On 28 Sep 2008, at 10:15, ABorka wrote: Is the exports now supported in Linux or it's a glitch that apache loads the modules with the exports in them? It is now supported, as long as the exports name is the same as the original variable's name. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
On Thu, Oct 2, 2008 at 10:14 PM, ABorka [EMAIL PROTECTED] wrote: Any suggestion why apache 2.2.8 does not want to load the FPC compiled apache modules (ex: mod_hello.pp in packages/httpd2/examples) on Linux? Some time ago I suggested for you to test older apache versions. I still suggest that. Also try Apache 2.0. If older versions work, then we should start looking for what changed. If not even that works then look for something more basic. -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
On Thu, Oct 2, 2008 at 10:53 PM, ABorka [EMAIL PROTECTED] wrote: It works under Windows with apache 2.2.9 which is even newer version, but not on Linux with apache 2.2.8 . Is it still needed to be checked on older Apache versions? Yes, it's a linux specific problem. You need to compare versions running in Linux. -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
OK, I'll see what can I do to get some older apache into a Linux install to test it. Did some more tests meanwhile, if the ap_hook_handler is executed below, all the modules loaded after this one in the apache2.conf, are stop working (always returning an empty page). If it is commented out, they are OK. So something is probably wrong with the Defaulthandler function declaration on Linux - or something - that breaks the module chain after the fpc compiled module. Also, the Defaulthandler is not called (not even the first instruction is executed in it ever). function DefaultHandler(r: PRequest_Rec): Integer; cdecl; ...snip... procedure RegisterHooks(p: Papr_pool_t); cdecl; begin ap_hook_handler(@DefaultHandler, nil, nil, APR_HOOK_MIDDLE); end; The module_struct declaration is OK theoretically because the Registerhooks procedure is called after the module is loaded by apache. Felipe Monteiro de Carvalho wrote: On Thu, Oct 2, 2008 at 10:53 PM, ABorka [EMAIL PROTECTED] wrote: It works under Windows with apache 2.2.9 which is even newer version, but not on Linux with apache 2.2.8 . Is it still needed to be checked on older Apache versions? Yes, it's a linux specific problem. You need to compare versions running in Linux. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
wow, I just downloaded the source code of apache 2.2.9 and I can't even find ap_hook_handler! o.O I think they removed the function. I just looked at the apache 2.2 fpc headers, and the version info is missing. I somehow forgot to write in which apache version the translation was based. based on the huge difference between our headers and the c headers that I see, I think that the entire fpc apache 2.2 headers need to be reviewed. But I am really confused. How could apache 2.2 change so much? Maybe it was still experimental when I did the initial translation? And what substitutes ap_hook_handler? -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
My only short term solution for you would be: Use apache 2.0 The longer solution is: the apache 2.2 headers need a full review and update. Doing the C header to Pascal conversion is very easy, but a large manual work. I followed some guidelines which should be kept. The c headers are converted manually and things should be the same places as in the c headers, unless impossible because pascal requires them to be in the same type statement or something similar. The version upon which the conversion was last checked needs to be written -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
:) The C example still works with ap_hook_handler, maybe they made it a macro or something? I believe the translation was for apache 2.2.3 header files, based on the ap_mmn.inc included in fpc/packages/httpd22 In the comments there we can see * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor) * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor) } as last entry. The same file for apache 2.2.9 continues with more entries to * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor) * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor) * 20051115.4 (2.2.4) Added ap_get_server_banner() and * ap_get_server_description() (minor) * 20051115.5 (2.2.5) Added ap_mpm_safe_kill() (minor) * 20051115.6 (2.2.7) Added retry_set to proxy_worker (minor) * 20051115.7 (2.2.7) Added conn_rec::clogging_input_filters (minor) * 20051115.8 (2.2.7) Added flags to proxy_alias (minor) * 20051115.9 (2.2.7) Add ap_send_interim_response API * 20051115.10(2.2.7) Added ap_mod_status_reqtail (minor) * 20051115.11(2.2.7) Add *ftp_directory_charset to proxy_dir_conf * 20051115.12(2.2.8) Add optional function ap_logio_add_bytes_in() to mog_logio * 20051115.13(2.2.9) Add disablereuse and disablereuse_set * to proxy_worker struct (minor) * 20051115.14(2.2.9) Add ap_proxy_ssl_connection_cleanup and * add *scpool, *r and need_flush to proxy_conn_rec * structure * 20051115.15(2.2.9) Add interpolate_env to proxy_dir_conf and * introduce proxy_req_conf. * */ So from the MODULE_MAGIC_NUMBER_MINOR = 3;// 0...n we can see it was 2.2.3 when translated for FPC for apache 2.2.9, the MODULE_MAGIC_NUMBER_MINOR is 15 But the question is, if they changed it so much how come all this works for Windows then? Felipe Monteiro de Carvalho wrote: wow, I just downloaded the source code of apache 2.2.9 and I can't even find ap_hook_handler! o.O I think they removed the function. I just looked at the apache 2.2 fpc headers, and the version info is missing. I somehow forgot to write in which apache version the translation was based. based on the huge difference between our headers and the c headers that I see, I think that the entire fpc apache 2.2 headers need to be reviewed. But I am really confused. How could apache 2.2 change so much? Maybe it was still experimental when I did the initial translation? And what substitutes ap_hook_handler? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
On Thu, Oct 2, 2008 at 11:48 PM, ABorka [EMAIL PROTECTED] wrote: The C example still works with ap_hook_handler, maybe they made it a macro or something? No, otherwise it wouldn't link ... a better investigation shows it is still there. It seams I made some mistakes (spotlight also didn't help me). I was looking at some http files which come with Mac OS X and they seam to have nothing to do with the standard apache files ... Looking at the correct files they didn't change that much ... this moves us back considerably. -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
Also, then I looked at ap_config.h instead of http_config.h! o.O I need to sleep ... And searching to ap_hook_handler obviously shows nothing, because they use their bizarre declaration method in apache. -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] library export in Linux
On 28 Sep 2008, at 10:15, ABorka wrote: Is the exports now supported in Linux or it's a glitch that apache loads the modules with the exports in them? It is now supported, as long as the exports name is the same as the original variable's name. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel