Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80170
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Python extension using a C library with one 'hello' function |
| Followup-To | comp.lang.python |
| Date | 2014-11-04 16:22 +0630 |
| Organization | Home |
| Message-ID | <m3ab5o$kuo$1@dont-email.me> (permalink) |
Followups directed to: comp.lang.python
https://github.com/Veek/Python/tree/master/junk/hello
doesn't work.
I have:
hello.c which contains: int hello(void);
hello.h
To wrap that up, i have:
hello.py -> _hello (c extension) -> pyhello.c -> method py_hello()
People using this will do:
python3.2>> import hello
python3.2>> hello.hello()
It doesn't compile/work.
deathstar> python setup.py build_ext --inplace
running build_ext
building '_hello' extension
creating build
creating build/temp.linux-x86_64-3.2
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -
D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -
Werror=format-security -fPIC -I/usr/include/python3.2mu -c pyhello.c -o
build/temp.linux-x86_64-3.2/pyhello.o
pyhello.c:15:6: warning: character constant too long for its type [enabled
by default]
pyhello.c:15:5: warning: initialization makes pointer from integer without a
cast [enabled by default]
pyhello.c:15:5: warning: (near initialization for 'hellomethods[0].ml_name')
[enabled by default]
pyhello.c:15:5: warning: initialization from incompatible pointer type
[enabled by default]
pyhello.c:15:5: warning: (near initialization for 'hellomethods[0].ml_meth')
[enabled by default]
pyhello.c:15:5: warning: initialization makes integer from pointer without a
cast [enabled by default]
pyhello.c:15:5: warning: (near initialization for
'hellomethods[0].ml_flags') [enabled by default]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro
build/temp.linux-x86_64-3.2/pyhello.o -o
/root/github/junk/hello/_hello.cpython-32mu.so
>>> import hello
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "hello.py", line 1, in <module>
from _hello import *
ImportError: ./_hello.cpython-32mu.so: undefined symbol: hello
>>>
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 16:22 +0630
Re: Python extension using a C library with one 'hello' function Chris Angelico <rosuav@gmail.com> - 2014-11-05 01:57 +1100
Re: Python extension using a C library with one 'hello' function Søren <sd@syntonetic.com> - 2014-11-04 13:11 +0100
Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 21:46 +0630
Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 10:30 -0500
Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 21:45 +0630
Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 11:28 -0500
Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 22:13 +0630
Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 22:39 +0630
Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 12:28 -0500
Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 23:03 +0630
Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 13:28 -0500
csiph-web