Python论坛  - 讨论区

标题:[python-chinese] 在windows平台上,如何将C语言写的扩展模块链接到python解释

2007年10月26日 星期五 23:20

张强 babyblue_963.student在sina.com
星期五 十月 26 23:20:23 HKT 2007

ÆäʵÈç¹ûʹÓÃC++À´×öµÄ»°£¬Ò²ÊÇÂùÈÝÒ×µÄ
ʹÓÃboostÖеÄpython¿âÀ´·â×°£¬
´ÓÎÒ¸öÈËʹÓÿ´£¬Ö»Òª°ÑdllºÍÄãÐèÒªÓõ½µÄpy½Å±¾·Åµ½Ò»Æð£¬
ÊÇ¿ÉÒÔʹÓõÄ
  ----- Original Message ----- 
  From: Zhou Honglin 
  To: python-chinese在lists.python.cn 
  Sent: Tuesday, July 03, 2007 6:18 PM
  Subject: Re: [python-chinese]ÔÚwindowsƽ̨ÉÏ£¬ÈçºÎ½«CÓïÑÔдµÄÀ©Õ¹Ä£¿éÁ´½Óµ½python½âÊÍÆ÷


  dllµÄ»°»áÌáʾÕÒ²»µ½£¬Ó¦¸Ã°ÑÀ©Õ¹Ãû¸Ä³É.pyd°É


  On 7/3/07, huanghao.c <huanghao.c在gmail.com> wrote: 
    win ÉϵĻ°£¬±àÒë³É dll, link µÄʱºò¼ÓÉÏ python2.x µÄlib£¬ È»ºó°É dll ·Å
    µ½¿âËÑË÷·¾¶Àï¡£

    pyh дµÀ:
    >  Çë½Ìһϣ¬ÓÃcдÁËÒ»¸ö¼òµ¥µÄhellomodule.cÎļþ£¬ÈçÏ£º
    >       #include "Python.h"
    >
    >>> static PyObject *sayhello(PyObject *self)
    >>> {
    >>> return Py_BuildValue("s","Hello Python World!");
    >>> } 
    >>> static PyMethodDef hellomethods[]=
    >>> {
    >>> {
    >>> "say",sayhello,METH_VARARGS
    >>> },
    >>> {
    >>> NULL,NULL
    >>> } 
    >>> };
    >>> DL_EXPORT(void) inithello()
    >>> {
    >>> Py_InitModule("hello",hellomethods);
    >>> }
    >>> ÈçºÎ±àÒëÔËÐÐÄØ£¿
    >>> лл
    >>> 
    > _______________________________________________
    > python-chinese
    > Post: send python-chinese在lists.python.cn
    > Subscribe: send subscribe to python-chinese-request在lists.python.cn
    > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
    > Detail Info: http://python.cn/mailman/listinfo/python-chinese

    _______________________________________________
    python-chinese
    Post: send python-chinese在lists.python.cn 
    Subscribe: send subscribe to python-chinese-request在lists.python.cn
    Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese




------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071026/b2c21ef6/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号