如何在GWANC脚本中嵌入perl脚本?

如何在GWANC脚本中嵌入perl脚本?,c,perl,g-wan,C,Perl,G Wan,下面是我的c脚本。我不知道为什么找不到EXTERN.h和perl.h,所以我在做下面的用户定义链接。如果你能解决这个问题,也请帮忙 我试图在C中嵌入perl脚本。该文件是hell.C,是hello.C文件的缩写 希望从c运行嵌入式perl脚本 尝试运行gwan时出现以下错误: In file included from /usr/lib/perl/5.10.1/CORE/perl.h:2424:0, from /home/qryos/Downloads/gwan

下面是我的c脚本。我不知道为什么找不到EXTERN.h和perl.h,所以我在做下面的用户定义链接。如果你能解决这个问题,也请帮忙

我试图在C中嵌入perl脚本。该文件是hell.C,是hello.C文件的缩写

希望从c运行嵌入式perl脚本

尝试运行gwan时出现以下错误:

In file included from /usr/lib/perl/5.10.1/CORE/perl.h:2424:0,
                 from /home/qryos/Downloads/gwan_linux64-bit/0.0.0.0_8080/#0.0.0.0/csp/hell.c:9:
/usr/lib/perl/5.10.1/CORE/handy.h:108:0: warning: "bool" redefined
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include/stdbool.h:33:0: note: this is the location of the previous definition
In file included from /usr/lib/perl/5.10.1/CORE/perl.h:3427:0,
                 from /csp/hell.c:9:
/usr/lib/perl/5.10.1/CORE/utf8.h:46:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
In file included from /csp/hell.c:9:0:
/usr/lib/perl/5.10.1/CORE/perl.h:4205:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
/usr/lib/perl/5.10.1/CORE/perl.h:4207:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
实际脚本

// ============================================================================
// C servlet sample for the G-WAN Web Application Server (http://trustleap.ch/)
// ----------------------------------------------------------------------------
// hello.c: just used with ab (ApacheBench) to benchmark a minimalist servlet
// ============================================================================
#include "gwan.h" // G-WAN exported functions
//#include <EXTERN.h>
//#include <perl.h>
#include "/usr/lib/perl/5.10.1/CORE/perl.h"
#include "/usr/lib/perl/5.10.1/CORE/EXTERN.h"

    static PerlInterpreter *my_perl;

/*
    int main(int argc, char **argv, char **env)
    {
        char *args[] = { NULL };
        PERL_SYS_INIT3(&argc,&argv,&env);
        my_perl = perl_alloc();
        perl_construct(my_perl);
        perl_parse(my_perl, NULL, argc, argv, NULL);
        PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
        call_argv("showtime", G_DISCARD | G_NOARGS, args);
        perl_destruct(my_perl);
        perl_free(my_perl);
        PERL_SYS_TERM();
    }
*/

int main(int argc, char *argv[], char *env[])
{
   static char msg[] = "Hello, ANSI C!";
   xbuf_ncat(get_reply(argv), msg, sizeof(msg) - 1);

/*
        //PERL_SYS_INIT3(&argc,&argv,&env);
        my_perl = perl_alloc();
        perl_construct(my_perl);
        perl_parse(my_perl, NULL, argc, argv, NULL);
        PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
//        call_argv("showtime", G_DISCARD | G_NOARGS, args);
        perl_destruct(my_perl);
        perl_free(my_perl);
        PERL_SYS_TERM();
*/

   return 200; // return an HTTP code (200:'OK')
}

Perl C头中有编译错误。你应该从这个开始

主要问题似乎是缺少定义,查找Perl目录树依赖项,并使用G-WAN
#pragma include
指令添加任何缺少的目录:

#pragma include "/usr/lib/perl/5.10.1/"
然后,您将能够使用
#include


请记住,G-WAN不会编译无法使用GCC编译的程序。因此,您的第一步可能是使您的Perl脚本嵌入作为一个独立程序工作。。。然后尝试将其与G-WAN集成。

#pragma include“/usr/lib/perl/5.10.1/”不起作用。我必须让它#pragma include“/usr/lib/perl/5.10.1/CORE/”但错误仍然存在。请看更新。感谢博士;我想了解如何将文件与hiredis和ssdb.io的示例安装教程正确链接,以便从头开始安装ubuntu或centos。我的程序作为独立程序工作。我精通php和perl,但在玩了一周g-wan之后,我仍然无法在上面编写一个像样的程序。主要是因为上面的链接。我想在cpp和redis的hiredis中使用ssdb.io。你能用例子做一些关于正确的库链接的教程吗?ubuntu服务器(先是ubuntu服务器,然后是centos服务器)从头开始?我可以纯粹用php或perl编写代码,但没有必要为此使用gwan,因为归根结底,潜在的瓶颈/性能问题仍然是语言。如果我能正确地完成这个链接,我相信我可以开始贡献一些示例代码。。。这真的很难。基本原理是在gwan中使用C或CPP,并且只使用它们。希望看到一些嵌入式perl在gwan C/CPP脚本上运行(或嵌入式php在运行)对不起,我想我要的是docker ubuntu for g-wan,它可以运行hiredis和ssdb作为示例。谢谢请把它编成dockerize。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: hell.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/perl/5.10.1/CORE/perl.h:2424:0,
                 from /home/example/Downloads/gwan/0.0.0.0_8080/#0.0.0.0/csp/hell.c:9:
/usr/lib/perl/5.10.1/CORE/handy.h:108:0: warning: "bool" redefined
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include/stdbool.h:33:0: note: this is the location of the previous definition
In file included from /usr/lib/perl/5.10.1/CORE/perl.h:4829:0,
                 from /csp/hell.c:9:
/usr/lib/perl/5.10.1/CORE/proto.h:690:47: error: expected declaration specifiers or '...' before 'off64_t'
/usr/lib/perl/5.10.1/CORE/proto.h:697:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Perl_do_sysseek'
/usr/lib/perl/5.10.1/CORE/proto.h:702:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Perl_do_tell'
/usr/lib/perl/5.10.1/CORE/proto.h:6019:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Perl_PerlIO_tell'
/usr/lib/perl/5.10.1/CORE/proto.h:6020:53: error: expected declaration specifiers or '...' before 'off64_t'
/csp/hell.c:29:5: error: conflicting types for 'main'
/home/example/Downloads/gwan/include/gwan.h:36:13: note: previous declaration of 'main' was here
#pragma include "/usr/lib/perl/5.10.1/"