AeroEng43 / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Tutorial 'Generic Type' example fails to compile to extension module #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Generic Type example ( in the readme.html ) does not compile to an
extension module

What is the expected output? What do you see instead?
I'm guessing it should spit out a pyd, but instead I get:

C:\shedskin-0.1\shedskin>shedskin -e gtype_test.py
*** SHED SKIN Python-to-C++ Compiler 0.1 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)

[iterative type analysis..]
***
iterations: 3 templates: 49
template <class A> class matrix
[generating c++ code..]

C:\shedskin-0.1\shedskin>make
g++  -O2 -pipe -Wno-deprecated  -I. -IC:/shedskin-0.1/shedskin/lib
-Ic:/python25
/include -D__SS_BIND gtype_test.cpp
C:/shedskin-0.1/shedskin/lib/builtin.cpp C:/
shedskin-0.1/shedskin/lib/re.cpp -lgc -lpcre  -shared -Lc:/python25/libs
-lpytho
n25 -o gtype_test.pyd
In file included from gtype_test.cpp:1:
gtype_test.hpp:41: error: expected constructor, destructor, or type
conversion b
efore '*' token
gtype_test.hpp:41: error: expected `;' before '*' token
gtype_test.cpp:34: error: using-declaration for non-member at class scope
gtype_test.cpp:34: error: expected `;' before '*' token
gtype_test.cpp: In function `PyObject* __gtype_test__::matrixNew(PyTypeObject*,
PyObject*, PyObject*)':
gtype_test.cpp:47: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp:47: error: `__gtype_test__::matrix' is not a type
gtype_test.cpp:48: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp:49: error: `matrix___init__' undeclared (first use this
function)

gtype_test.cpp:49: error: (Each undeclared identifier is reported only once for
each function it appears in.)
gtype_test.cpp: In function `void
__gtype_test__::matrixDealloc(__gtype_test__::
matrixObject*)':
gtype_test.cpp:56: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp: At global scope:
gtype_test.cpp:135: error: `template<class A> class __gtype_test__::matrix'
used
 without template parameters
gtype_test.cpp: In function `PyObject* __gtype_test__::__to_py__()':
gtype_test.cpp:136: error: invalid use of `this' in non-member function
gtype_test.cpp:137: error: invalid use of `this' in non-member function
gtype_test.cpp:139: error: 'struct __gtype_test__::matrixObject' has no
member n
amed '__ss_object'
gtype_test.cpp:139: error: invalid use of `this' in non-member function
gtype_test.cpp:140: error: 'struct __gtype_test__::matrixObject' has no
member n
amed '__ss_object'
gtype_test.cpp: At global scope:
gtype_test.cpp:148: error: expected constructor, destructor, or type conversion
before '*' token
gtype_test.cpp:148: error: expected `;' before '*' token
make: *** [gtype_test.pyd] Error 1

It compiles fine to an exe. Code is below for convenience

class matrix:
    def __init__(self, hop):
        self.unit = hop

m1 = matrix([1])
m2 = matrix([1.0])

hope it is helpful :)

What version of the product are you using? On what operating system?
SS 0.1, WinXP 32-bit

Please provide any additional information below.

Original issue reported on code.google.com by blrharl...@gmail.com on 24 Feb 2009 at 7:27

GoogleCodeExporter commented 8 years ago
hi benjamin,

thanks for reporting! I put this on my TODO list to investigate. it's probably 
a bit
complicated to export generic types in extension modules, but they should 
compile at
least, and in such a way that you can still use the non-generic parts.. 
(especially
if the code is mentioned in the tutorial of course! ;)) 

Original comment by mark.duf...@gmail.com on 27 Feb 2009 at 10:13

GoogleCodeExporter commented 8 years ago
okay,

I made thing degrade gracefully in the face of generic types/functions, so they 
are
simply not exported now. this is about as far as I'd like to go for now..

thanks again for reporting.

Original comment by mark.duf...@gmail.com on 26 Mar 2009 at 1:23