Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: How convert header file to XS by h2xs?

by xiaoyafeng (Deacon)
on Mar 20, 2010 at 01:53 UTC ( [id://829743]=note: print w/replies, xml ) Need Help??


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

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

  • Comment on Re^4: How convert header file to XS by h2xs?

Replies are listed 'Best First'.
Re^5: How convert header file to XS by h2xs?
by syphilis (Archbishop) on Mar 20, 2010 at 10:17 UTC
    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.

        I change the name of function from max to lc_max. it works! I don't understand why...

        It could be because something in the included header files declares max some other way, so there's a conflict when the compiler reaches your declaration of max in test.h.

        If you really want to know, grep for "max" in the -E output...  Or, to avoid name clashes in the first place, simply give your function a less "common" name.

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://829743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found