in reply to Re^2: How convert header file to XS by h2xs?
in thread How convert header file to XS by h2xs?

So, how can I do next?

As the compiler obviously thinks the error has to do with test.h, it would seem to make sense to focus on that issue.  Could you try what Rob and I suggested above, i.e. simply try to compile test.c alone (which includes test.h) — possibly with option -E to get an idea of what code the compiler is actually trying to compile.

Replies are listed 'Best First'.
Re^4: How convert header file to XS by h2xs?
by xiaoyafeng (Deacon) on Mar 20, 2010 at 01:53 UTC

    the first one (test.c) run correctly, the later throw the same error as my original post.

    And I think what Rob mean is checking the difference of test.c and Mytest.c. since I'm new to XS, I cant find something strange.

    Besides, Because the same files could convert to XS successfully on ubuntu, does it mean this problem is only related to Win32 platform? should I report author of h2xs it?




    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      And I think what Rob mean is checking the difference of test.c and Mytest.c

      I was actually thinking that there must be some difference between Mytest/test.h and the test.h that you provided in your first post. In Mytest.xs, could you try changing line 7 from #include  "test.h" to #include  "../test.h" and see if that makes any difference. Also, providing a copy'n'paste of the output when using the -E switch, as almut suggested, would perhaps help us work out what's going wrong.

      should I report author of h2xs it?

      No - I've just done exactly the same as you did (also using Strawberry Perl 5.10.1, as you did), and can't reproduce the problem. I ran:

      h2xs -Afn Mytest
      copy test.c Mytest
      copy test.h Mytest
      h2xs -Oxan Mytest test.h

      Then, when I switch to the Mytest folder, I get:
      C:\_32\pscrpt\Mytest>perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Mytest C:\_32\pscrpt\Mytest>dmake cp lib/Mytest.pm blib\lib\Mytest.pm C:\strawberry\perl\bin\perl.exe C:\strawberry\perl\lib\ExtUtils\xsubpp + -typemap C:\strawberry\perl\lib\ExtUtils\typemap Mytest.xs > Mytest.xsc && C: +\strawberry\perl\bin\perl.exe -MExtUtils::Command -e "mv" -- Mytest.x +sc Mytest.c Please specify prototyping behavior for Mytest.xs (see perlxs manual) gcc -c -I. -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE - +DPERL_IMPL ICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_RE +ADFIX -s - O2 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" "-IC:\strawberr +y\perl\lib \CORE" Mytest.c Running Mkbootstrap for Mytest () C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 +Mytest.bs C:\strawberry\perl\bin\perl.exe -MExtUtils::Mksymlists \ -e "Mksymlists('NAME'=>\"Mytest\", 'DLBASE' => 'Mytest', 'DL_FUNC +S' => { } , 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" dlltool --def Mytest.def --output-exp dll.exp g++ -o blib\arch\auto\Mytest\Mytest.dll -Wl,--base-file -Wl,dll.base - +mdll -s -L "C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib" Mytest.o -Wl,--i +mage-base, 0x3e0d0000 C:\strawberry\perl\lib\CORE\libperl510.a -lmoldname -lkern +el32 -luse r32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleau +t32 -lneta pi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 dll.e +xp dlltool --def Mytest.def --base-file dll.base --output-exp dll.exp g++ -o blib\arch\auto\Mytest\Mytest.dll -mdll -s -L"C:\strawberry\perl +\lib\CORE" -L"C:\strawberry\c\lib" Mytest.o -Wl,--image-base,0x3e0d0000 C:\stra +wberry\per l\lib\CORE\libperl510.a -lmoldname -lkernel32 -luser32 -lgdi32 -lwinsp +ool -lcomd lg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_3 +2 -lmpr -l winmm -lversion -lodbc32 -lodbccp32 dll.exp C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 755 +blib\arch\ auto\Mytest\Mytest.dll C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e "cp" -- Mytest. +bs blib\ar ch\auto\Mytest\Mytest.bs C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 +blib\arch\ auto\Mytest\Mytest.bs C:\_32\pscrpt\Mytest>
      We first ought to find out why it's not working for you.

      Cheers,
      Rob

        I changed "./test.h" to "../test.h", but it still failed.

        Below is the output message after adding -E switch: UPDATE:

        Thanks for BrowserUk's reminding, I shrink the log size for makeing this reply re-readable. But it seems useless :(

        I change the name of function from max to lc_max. it works! I don't understand why this change can affect. Hope gurus enlighten me about this.

        Sadly, I sent bug report before I read your post :(




        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction