Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55226
| From | Robin Becker <robin@reportlab.com> |
|---|---|
| Subject | PyDoc_STRVAR error in msvc compile |
| Date | 2013-10-01 17:41 +0100 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.564.1380645732.18130.python-list@python.org> (permalink) |
I'm trying to port C code that compiles under 2.7 to 3.3; the intention is to
make things work under both.
I used to use raw strings for the module documentation, but my porting guide
suggests that I should be using PyDoc_STRVAR. That works for me using linux, but
I'm getting errors under windows compiles
My usage looks like this
PyDoc_STRVAR(__DOC__,
"Helper extension module for xxx.\n\
\n\
Interface summary:\n\
\n\
import _xxx\n\
......\n"
#ifdef ZZZZ
" ZZZZ stuff\n"
#endif
"\n\
.........\n\
");
but it seems that the MSVC compiler for python-2.7 cannot hack this and I get
messages like this
> _xxx.c
> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2121: '#' : invalid character : possibly the
> result of a macro expansion
> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2146: syntax error : missing ';' before ident
> ifier 'ifdef'
> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2143: syntax error : missing '{' before 'cons
> tant'
> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2059: syntax error : '<Unknown>'
> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2121: '#' : invalid character : possibly the
> result of a macro expansion
> error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
line 66 is the closing paranthesis.
Anyone got any ideas?
Previously I used code like this
static char moduleDoc ="Helper extension module for xxx.\n\
\n\
Interface summary:\n\
\n\
import _xxx\n\
......\n"
#ifdef ZZZZ
" ZZZZ stuff\n"
#endif
"\n\
.........\n\
";
but the registration and usage differs quite a lot between python2 & python3 so
I thought to switch to the newer mechanism.
--
Robin Becker
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
PyDoc_STRVAR error in msvc compile Robin Becker <robin@reportlab.com> - 2013-10-01 17:41 +0100
csiph-web