I tried but apparently C compiler doesn't recognize some C++ only grammar: test_cpp_pl_06b1.xs(5) : error C2773: #import and #using available only in C++ c ompiler test_cpp_pl_06b1.xs(6) : error C2773: #import and #using available only in C++ c ompiler test_cpp_pl_06b1.xs(7) : error C2773: #import and #using available only in C++ c ompiler test_cpp_pl_06b1.xs(8) : error C2061: syntax error : identifier 'namespace' test_cpp_pl_06b1.xs(8) : error C2059: syntax error : ';' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.EXE"' : return code '0x2' Stop.
To me, There seems be 2 ways to do: 1. compile a dll then call it from a Inline::C/CPP script 2. below is messages in buildlog of VS, maybe I can find something useful? Command Lines Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000001352410128.rsp" with contents [ /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\call_excel.cpp" ] Creating command line "cl.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000001352410128.rsp" /nologo /errorReport:prompt" Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000002352410128.rsp" with contents [ /OUT:"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\Debug\call_excel.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\call_excel.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\Debug\call_excel.pdb" /SUBSYSTEM:WINDOWS /ENTRY:"main" /DYNAMICBASE /NXCOMPAT /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Debug\call_excel.obj" ".\Debug\call_excel.exe.embed.manifest.res" ] Creating command line "link.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000002352410128.rsp" /NOLOGO /ERRORREPORT:PROMPT" Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000003352410128.rsp" with contents [ /out:".\Debug\call_excel.exe.embed.manifest" /notify_update /manifest ".\Debug\call_excel.exe.intermediate.manifest" ] Creating command line "mt.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\RSP000003352410128.rsp" /nologo" Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\BAT000004352410128.bat" with contents [ @echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep" ] Creating command line """c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\BAT000004352410128.bat""" Output Window Compiling... call_excel.cpp Linking... Embedding manifest... Results Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\call_excel\call_excel\Debug\BuildLog.htm" call_excel - 0 error(s), 0 warning(s) On Mon, Jul 23, 2012 at 2:08 PM, Sisyphus <sisyph...@optusnet.com.au> wrote: > > ----- Original Message ----- From: "Xiao Yafeng" <xyf.x...@gmail.com> > To: "Sisyphus" <sisyph...@optusnet.com.au> > Cc: "inline" <inline@perl.org>; "David Oswald" <daosw...@gmail.com> > Sent: Monday, July 23, 2012 3:14 PM > Subject: Re: does Inline::CPP recognize #import ? > > > > installed Inline::CPP 0.39, but situation doesn't change: >> >> use strict; >> use warnings; >> use Inline CPP=>Config=> >> CC => 'cl.exe /TP', >> > > Bad advice from me. > Looks like the default is 'cl -TP -EHsc' (which should have been the > default suggested during the 'perl Makefile.PL' step, and which is what you > should use). > So try that instead. > > It still might not work. > > The main problem is that we don't seem to have an Inline::CPP expert who > also understands the C++ idiosyncracies of MS compilers. > (I fail to qualify on both counts - in fact I don't know C++ at all.) > > If it's possible for you to test : > What happens if you try the same test script using an Inline::C and > Inline-CPP-0.39 that was built for a MinGW (gcc) compiler ? > > Cheers, > Rob >