我找到了http://support.zeus.com/zws/examples/2005/12/16/hello_world_in_perl_and_c这两个例子正在工作。
现在我为 Ada 尝试了这个,但两天后我就无法完成它。
fcgi_stdio.ads
with Interfaces.C;
with Interfaces.C.Strings;
package fcgi_stdio is
function FCGI_Accept return Interfaces.C.int;
pragma Import (C, FCGI_Accept, "FCGI_Accept");
procedure FCGI_printf (str : Interfaces.C.Strings.chars_ptr);
pragma Import (C, FCGI_printf, "FCGI_printf");
end fcgi_stdio;
测试.adb
with fcgi_stdio;
with Interfaces.C;
with Interfaces.C.Strings;
procedure Test is
begin
while Integer (fcgi_stdio.FCGI_Accept) >= 0 loop
fcgi_stdio.FCGI_printf (Interfaces.C.Strings.New_String ("Content-Type: text/plain" & ASCII.LF & ASCII.LF));
fcgi_stdio.FCGI_printf (Interfaces.C.Strings.New_String ("Hello World from Ada!" & ASCII.LF));
end loop;
end Test;
当我在控制台中运行它时,我收到以下错误:
$ ./test
raised STORAGE_ERROR : stack overflow or erroneous memory access
Apache error_log 显示:
Premature end of script headers: test
有谁知道我怎样才能让它工作?