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 | [reply] [d/l] [select] |
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.
| [reply] [d/l] |
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.
| [reply] [d/l] [select] |
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
| [reply] |