----- Original Message -----
From: "David Oswald"
Here's an example:
use Inline CPP => 'DATA'
greet();
__DATA__
__CPP__
#ifdef __INLINE_CPP_STANDARD_HEADERS
#include <string>
#else
#include <string.h>
#endif
#ifdef __INLINE_CPP_NAMESPACE_STD
using namespace std;
#endif
void greet() {
string mygreeting = "Hello world!\n";
cout << mygreeting;
}
// End of CPP
(First line of that example is missing the ';' at the end, btw.)
You probably should work that into a test script - as it's not working with
either of my MS compilers (though the 0.33_003 test suite is passing all
tests). No problems with my mingw g++ compiler.
Let's just concentrate on my 32-bit MSVC++ 7.0 compiler. It's a fairly
regular sort of compiler (that doesn't need to link to any weird libraries),
and I have a perl-5.10.0 that was built using it.
Having built and installed Inline-CPP-0.33_003 it defines both
__INLINE_CPP_STANDARD_HEADERS and __INLINE_CPP_NAMESPACE_STD to 1.
But here's what I get when I try to build the above demo:
#########################################
C:\_64\pscrpt\inline>perl davido.pl
Microsoft (R) Program Maintenance Utility Version 7.00.9466
Copyright (C) Microsoft Corporation. All rights reserved.
C:\_32\perl_vc7\5.10.0\bin\perl.exe
C:\_32\perl_vc7\5.10.0\lib\ExtUtils\
xsubpp -typemap "C:\_32\perl_vc7\5.10.0\lib\ExtUtils\typemap"
davido_pl_c4daa.
xs > davido_pl_c4daa.xsc &&
C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Comm
and -e mv davido_pl_c4daa.xsc davido_pl_c4daa.c
cl -TP -c -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE
-DN
O_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PER
LIO -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\"
"-IC:\_32
\perl_vc7\5.10.0\lib\CORE" davido_pl_c4daa.c
davido_pl_c4daa.c
C:\vsnet\Vc7\include\istream(990) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\ostream(467) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\ostream(459) : while compiling class-template
member function 'std::basic_ostream<_Elem,_Traits>::_Myt
&std::basic_ostream<_Elem,_Traits>::put(_Elem)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\vsnet\Vc7\include\ostream(535) : see reference to class template
instantiation 'std::basic_ostream<_Elem,_Traits>' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\vsnet\Vc7\include\ostream(467) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\ostream(459) : while compiling class-template
member function 'std::basic_ostream<_Elem,_Traits>::_Myt
&std::basic_ostream<_Elem,_Traits>::put(_Elem)'
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>
]
C:\vsnet\Vc7\include\ostream(536) : see reference to class template
instantiation 'std::basic_ostream<_Elem,_Traits>' being compiled
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>
]
C:\vsnet\Vc7\include\istream(99) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\istream(89) : while compiling class-template
member function 'bool std::basic_istream<_Elem,_Traits>::_Ipfx(bool)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\vsnet\Vc7\include\istream(791) : see reference to class template
instantiation 'std::basic_istream<_Elem,_Traits>' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\vsnet\Vc7\include\istream(99) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\istream(89) : while compiling class-template
member function 'bool std::basic_istream<_Elem,_Traits>::_Ipfx(bool)'
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>
]
C:\vsnet\Vc7\include\istream(792) : see reference to class template
instantiation 'std::basic_istream<_Elem,_Traits>' being compiled
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>
]
C:\vsnet\Vc7\include\xstring(1201) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\xstring(1195) : while compiling class-template
member function 'void
std::basic_string<_Elem,_Traits,_Ax>::_Copy(std::basic_string<_Elem,_Traits,_Ax>::size_type,std::basic_string<_Elem,_Traits,_Ax>::size_type)'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
C:\vsnet\Vc7\include\xstring(1295) : see reference to class template
instantiation 'std::basic_string<_Elem,_Traits,_Ax>' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
C:\vsnet\Vc7\include\xstring(1201) : warning C4530: C++ exception handler
used,
but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\xstring(1195) : while compiling class-template
member function 'void
std::basic_string<_Elem,_Traits,_Ax>::_Copy(std::basic_string<
_Elem,_Traits,_Ax>::size_type,std::basic_string<_Elem,_Traits,_Ax>::size_type)'
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>,
_Ax=std::allocator<wchar_t>
]
C:\vsnet\Vc7\include\xstring(1297) : see reference to class template
instantiation 'std::basic_string<_Elem,_Traits,_Ax>' being compiled
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>,
_Ax=std::allocator<wchar_t>
]
C:\vsnet\Vc7\include\xlocnum(87) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\xlocnum(80) : while compiling class-template
member
function 'void std::numpunct<_Elem>::_Init(const std::_Locinfo &)'
with
[
_Elem=char
]
C:\vsnet\Vc7\include\xlocnum(1132) : see reference to class template
instantiation 'std::numpunct<_Elem>' being compiled
with
[
_Elem=char
]
C:\vsnet\Vc7\include\xlocnum(87) : warning C4530: C++ exception handler
used, but unwind semantics are not enabled. Specify /EHsc
C:\vsnet\Vc7\include\xlocnum(80) : while compiling class-template
member
function 'void std::numpunct<_Elem>::_Init(const std::_Locinfo &)'
with
[
_Elem=wchar_t
]
C:\vsnet\Vc7\include\xlocnum(1133) : see reference to class template
instantiation 'std::numpunct<_Elem>' being compiled
with
[
_Elem=wchar_t
]
Running Mkbootstrap for davido_pl_c4daa ()
C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Command -e chmod 644
david_pl_c4daa.bs
C:\_32\perl_vc7\5.10.0\bin\perl.exe -MExtUtils::Mksymlists -e
"Mksymlists('NAME'=>\"davido_pl_c4daa\", 'DLBASE' => 'davido_pl_c4daa',
'DL_FUNCS' => {
}, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);"
link -out:blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.dll -dll -nolog
-o -nodefaultlib -debug -opt:ref,icf -libpath:"c:\_32\perl_vc7\5.10.0\lib\CORE"
-machine:x86 davido_pl_c4daa.obj
C:\_32\perl_vc7\5.10.0\lib\CORE\perl510.lib
C:\vsnet\VC7\lib\MSVCIRT.LIB C:\vsnet\VC7\lib\oldnames.lib
C:\vsnet\VC7\lib\kernel32.lib C:\vsnet\VC7\PlatformSDK\lib\user32.lib
C:\vsnet\VC7\PlatformSDK\lib\gd
i32.lib C:\vsnet\VC7\PlatformSDK\lib\winspool.lib
C:\vsnet\VC7\PlatformSDK\lib\comdlg32.lib
C:\vsnet\VC7\PlatformSDK\lib\advapi32.lib
C:\vsnet\VC7\PlatformSDK\lib\shell32.lib
C:\vsnet\VC7\PlatformSDK\lib\ole32.lib
C:\vsnet\VC7\PlatformSDK\lib\oleaut32.lib
C:\vsnet\VC7\PlatformSDK\lib\netapi32.lib
C:\vsnet\VC7\PlatformSDK\lib\uuid.lib
C:\vsnet\VC7\PlatformSDK\lib\ws2_32.lib C:\vsnet\VC7\PlatformSDK\lib\mpr.lib
C:\vsnet\VC7\PlatformSDK\lib\winmm.lib
C:\vsnet\VC7\PlatformSDK\lib\version.lib
C:\vsnet\VC7\PlatformSDK\lib\odbc32.lib
C:\vsnet\VC7\PlatformSDK\lib\odbccp32.lib
C:\vsnet\VC7\lib\msvcrt.lib -def:davido_pl_c4daa.def
Creating library blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.lib and
object lib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.exp
davido_pl_c4daa.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (__imp_??1?$basic_string@DU?$char_traits@D@std
@@V?$allocator@D@2@@std@@QAE@XZ) referenced in function "void __cdecl
greet(void
)" (?greet@@YAXXZ)
davido_pl_c4daa.obj : error LNK2019: unresolved external symbol "class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<(class std::basic_ostream<char,struct std::char_traits<char>
> &,class std::basic_string
<char,struct std::char_traits<char>,class std::allocator<char> > const &)"
(??6s
td@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$c
har_traits@D@std@@V?$allocator@D@2@@0@@Z) referenced in function "void
__cdecl g
reet(void)" (?greet@@YAXXZ)
davido_pl_c4daa.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > std::cout"
(__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)
davido_pl_c4daa.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall std::basic_string<char,struct
std::char_traits<char>,c
lass std::allocator<char> >::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >(char const *)"
(__imp_??0?$basic_string@DU?$char_trait
s@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) referenced in function "void
__cdecl
greet(void)" (?greet@@YAXXZ)
blib\arch\auto\davido_pl_c4daa\davido_pl_c4daa.dll : fatal error LNK1120: 4
unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
A problem was encountered while attempting to compile and install your
Inline
CPP code. The command that failed was:
nmake > out.make 2>&1
The build directory was:
C:\_64\pscrpt\inline\_Inline\build\davido_pl_c4daa
To debug the problem, cd to the build directory, and inspect the output
files.
at davido.pl line 0
INIT failed--call queue aborted.
#########################################
If I rebuild Inline-CPP-0.33_003 specifying 'cl -TP /EHsc' as the compiler
(instead of the default 'cl -TP'), then the test suite still passes, and all
that noise about "unwind semantics" being unavailable is removed, but the
exact same linking errors remain when I try to build the demo.
Anyone able to glean anything useful from those error messages ?
I think that most of the recent MS compilers will suffer the same fate.
There has been no such problem with the earlier releases of Inline::CPP
(from before David took it on), but that's probably just that nothing was
being done that made this problem apparent
I also get essentially the same with that other "troublesome" x64 MS
compiler, but it's probably simpler to just concentrate on this MSVC++ 7.0
compiler - having to deal with that bufferoverflowU.lib requirement would
just be an added complication at this stage.
In any case, I think it likely that the same fix will apply to both
compilers (and probably many other MS compilers as well).
Cheers,
Rob