Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92204
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'static': 0.03; 'subject:Python': 0.05; 'newbie': 0.05; 'callback': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'specifying': 0.09; 'python': 0.11; 'python.': 0.11; 'def': 0.14; 'argument': 0.15; 'output': 0.15; 'pyobject': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'of.': 0.22; 'defined': 0.23; 'example': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:" 20': 0.26; 'skip:m 30': 0.27; "i'm": 0.29; 'interface': 0.29; 'embed': 0.29; 'function:': 0.29; 'e.g.': 0.31; 'writes': 0.31; 'maybe': 0.31; 'source': 0.31; 'code': 0.31; 'to:addr:python-list': 0.35; 'done': 0.35; 'skip:* 20': 0.35; 'really': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'skip:i 20': 0.37; 'received:org': 0.38; 'skip:p 20': 0.38; 'method': 0.39; 'to:addr:python.org': 0.39; 'received:de': 0.40; 'called': 0.40; 'some': 0.40; 'received:217': 0.61; 'email addr:gmail.com': 0.64; 'plate': 0.84; 'do:': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | dieter <dieter@handshake.de> |
| Subject | Re: Embedded Python and C Callback functions |
| Date | Sun, 07 Jun 2015 08:02:33 +0200 |
| References | <daad7377-7a61-4e9e-a442-4ba48f7212b2@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Gmane-NNTP-Posting-Host | pd9e0affb.dip0.t-ipconnect.de |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
| Cancel-Lock | sha1:MkuFqVelt1E00Nh/WyRlgJl2z7c= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.229.1433656976.13271.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433656976 news.xs4all.nl 2878 [2001:888:2000:d::a6]:44083 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 3967 |
| X-Received-Body-CRC | 4022246863 |
| Xref | csiph.com comp.lang.python:92204 |
Show key headers only | View raw
doc.mefisto@gmail.com writes: > Hi. I'm a newbie in python. But I want embed it in my C program. > > There is such method of my class: > @staticmethod > def install_instr_callback(callback): > # set hook for every change of PC > m68k.set_instr_hook_callback(callback) > > And in my C code there is such callback function: > static PyObject *my_instr_callback(PyObject *self); > > I want call install_instr_callback from C with specifying of my callback. I do: > PyObject_CallMethod(myClass, "install_instr_callback", "(O)", my_instr_callback); > But python writes me: [b]null argument to internal routine[/b]. If this output really comes from "PyObject_CallMethod", then some passed in argument is likely "null" - maybe "myclass"? The Python-C interface is complicated. It might be advicible to use e.g. "cython" to get the boilder plate code and some intricacies taken care of. I have done this with "dm.xmlsec.binding". You can find in its source also an example for the callback defined in Python and called from "C".
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Embedded Python and C Callback functions doc.mefisto@gmail.com - 2015-06-06 11:09 -0700
Re: Embedded Python and C Callback functions dieter <dieter@handshake.de> - 2015-06-07 08:02 +0200
Re: Embedded Python and C Callback functions doc.mefisto@gmail.com - 2015-06-07 01:37 -0700
Re: Embedded Python and C Callback functions doc.mefisto@gmail.com - 2015-06-07 01:56 -0700
Re: Embedded Python and C Callback functions Laura Creighton <lac@openend.se> - 2015-06-07 11:49 +0200
Re: Embedded Python and C Callback functions doc.mefisto@gmail.com - 2015-06-07 02:51 -0700
Re: Embedded Python and C Callback functions Stefan Behnel <stefan_ml@behnel.de> - 2015-06-07 22:32 +0200
Re: Embedded Python and C Callback functions doc.mefisto@gmail.com - 2015-06-07 02:15 -0700
Re: Embedded Python and C Callback functions dieter <dieter@handshake.de> - 2015-06-08 07:44 +0200
csiph-web