http://www.perlmonks.org?node_id=778000

TomKane has asked for the wisdom of the Perl Monks concerning the following question:

I've just decided to try to learn how to work with perl XS. I am using VC++ 9.0 for Win32 (just downloaded). I'm using the example given by JamesNC in a previous post -- http://www.perlmonks.org/?node_id=510773 -- and have my own set of problems.

It appears that my compile ran okay, but the makefile is missing something that I need for the link to complete. I'm using the same source as JamesNC, I just named it 'simple.c', and I'm getting a link error message regarding the missing boot_simple symbol. That message is 5-6 lines from the bottom.

Can anyone see what is missing from the following nmake output (note that it was scraped off my screen)? Thanks.

D:\Perl\bin\perl.exe D:\Perl\lib\ExtUtils\xsubpp -typemap D:\ +Perl\lib\E xtUtils\typemap simple.xs > simple.xsc && D:\Perl\bin\perl.exe -MExtU +tils::Comm and -e mv simple.xsc simple.c Please specify prototyping behavior for simple.xs (see perlxs manual) cl -c -I. -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CO +NSOLE -DNO _STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPRIVLIB +_LAST_IN_I NC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSV +CRT_READFI X -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" " +-ID:\Perl\ lib\CORE" simple.c simple.c link -out:blib\arch\auto\simple\simple.dll -dll -nologo -nodef +aultlib -d ebug -opt:ref,icf -libpath:"D:\Perl\lib\CORE" -machine:x86 simple.ob +j D:\Per l\lib\CORE\perl58.lib oldnames.lib kernel32.lib user32.lib gdi32.lib w +inspool.li b comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netap +i32.lib uu id.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.l +ib msvcrt. lib -def:simple.def simple.def : error LNK2001: unresolved external symbol boot_simple simple.def : error LNK2001: unresolved external symbol boot_simple blib\arch\auto\simple\simple.lib : fatal error LNK1120: 2 unresolved e +xternals NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio +9.0\VC\BIN \link.EXE"' : return code '0x460' Stop.

Replies are listed 'Best First'.
Re: VC++ and XS -- again
by syphilis (Archbishop) on Jul 07, 2009 at 23:01 UTC
    When I go through the steps specified by JamesNC in his original post, everything works fine for me with VC++ 7.0.
    You'll notice in the output you provided that there's a cl command that gets run, followed by a link command. But, in between the running of those 2 commands, there ought to be the message "Running Mkbootstrap for simple ()", followed by the execution of a couple of perl commands. At least, that's what happens for me and, given the nature of the error message, I suspect it's relevant to the error itself.

    However, I don't know what's causing this.
    Does the same thing happen when you try to build real perl extensions from CPAN (eg Math::FFT) ?
    Which version of perl do you have ?
    Which version of ExtUtils::MakeMaker do you have ?
    Was changing the name of the module from "myModule" to "simple" the *only* thing you did differently to JamesNC ?

    Cheers,
    Rob
      Rob,

      I retraced all of my steps, that is, I did everything over more carefully. It completed cleanly. Now I have to see if I can make it run, but that's my problem, not VC++'s.

      Thanks.

      Tom