2007年07月17日 星期二 16:20
dll,很简单,2个函数代码如下: library Project1; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Classes; {$R *.RES} function PlusNum(x,y:integer):integer;stdcall; begin result:=x+y; end; function MinusNum(x,y:integer):integer;stdcall; begin result:=x-y; end; exports PlusNum index 1, MinusNum index 2; begin end. 在python shell里这样调用 mydll=ctypes.cdll.LoadLibrary('project1.dll') mydll.PlusNum(1,2) 提示出错,请问该如何调用? Traceback (most recent call last): File "", line 1, in ValueError: Procedure called with not enough arguments (8 bytes missing) or wrong calling convention -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070717/796ce75e/attachment.htm
2007年07月17日 星期二 16:43
Ô´ÂëºÃƯÁÁŶ£¬ÓÃʲôдµÄ£¬Õâô¶àÑÕÉ«£¬»¹ÄÜ·¢email ºî»ªÂ¡ 2007-07-17 ·¢¼þÈË£º jason python.nbfan ·¢ËÍʱ¼ä£º 2007-07-17 16:20:49 ÊÕ¼þÈË£º python-chinese在lists.python.cn ³ËÍ£º Ö÷Ì⣺ [python-chinese] Çë½ÌcpytesÈçºÎµ÷ÓÃ×Ô¶¨ÒåµÄdll dll£¬ºÜ¼òµ¥£¬2¸öº¯Êý´úÂëÈçÏ£º library Project1; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Classes; {$R *.RES} function PlusNum(x,y:integer) :integer;stdcall; begin result:=x+y; end; function MinusNum(x,y:integer) :integer;stdcall; begin result:=x-y; end; exports PlusNum index 1, MinusNum index 2; begin end. ÔÚpython shellÀïÕâÑùµ÷Óà mydll=ctypes.cdll.LoadLibrary('project1.dll') mydll.PlusNum(1,2) Ìáʾ³ö´í£¬ÇëÎʸÃÈçºÎµ÷Óã¿ Traceback (most recent call last): File "", line 1, in ValueError: Procedure called with not enough arguments (8 bytes missing) or wrong calling convention -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070717/c43eded7/attachment-0001.html
2007年07月18日 星期三 00:31
BorlandµÄDelphi ÔÚ07-7-17£¬ºî»ªÂ¡ <hou_hl在sina.com> дµÀ£º > > Ô´ÂëºÃƯÁÁŶ£¬ÓÃʲôдµÄ£¬Õâô¶àÑÕÉ«£¬»¹ÄÜ·¢email > > ------------------------------ > ºî»ªÂ¡ > 2007-07-17 > ------------------------------ > *·¢¼þÈË£º* jason python.nbfan > *·¢ËÍʱ¼ä£º* 2007-07-17 16:20:49 > *ÊÕ¼þÈË£º* python-chinese在lists.python.cn > *³ËÍ£º* > *Ö÷Ì⣺* [python-chinese] Çë½ÌcpytesÈçºÎµ÷ÓÃ×Ô¶¨ÒåµÄdll > > dll£¬ºÜ¼òµ¥£¬2¸öº¯Êý´úÂëÈçÏ£º > library Project1; > > { Important note about DLL memory management: ShareMem must be the > first unit in your library's USES clause AND your project's (select > Project-View Source) USES clause if your DLL exports any procedures or > functions that pass strings as parameters or function results. This > applies to all strings passed to and from your DLL--even those that > are nested in records and classes. ShareMem is the interface unit to > the BORLNDMM.DLL shared memory manager, which must be deployed along > with your DLL. To avoid using BORLNDMM.DLL, pass string information > using PChar or ShortString parameters. } > > uses > SysUtils, > Classes; > > {$R *.RES} > function PlusNum(x,y:integer) :integer;stdcall; > begin > result:=x+y; > end; > > function MinusNum(x,y:integer) :integer;stdcall; > begin > result:=x-y; > end; > > exports > PlusNum index 1, > MinusNum index 2; > > > begin > end. > > > ÔÚpython shellÀïÕâÑùµ÷Óà > mydll=ctypes.cdll.LoadLibrary('project1.dll') > mydll.PlusNum(1,2) > > Ìáʾ³ö´í£¬ÇëÎʸÃÈçºÎµ÷Óã¿ > Traceback (most recent call last): > File "", line 1, in > ValueError: Procedure called with not enough arguments (8 bytes missing) > or wrong calling convention > > _______________________________________________ > 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/20070718/59c201b5/attachment-0001.html
2007年07月18日 星期三 00:35
Òª±àдÌṩ¸øpythonʹÓõÄdll£¬ÐèҪʹÓÃÏà¹ØµÄWrapper¡£ ÄãgoogleÏÂPythonxxForDelphixx£¨Òª¸úÄãµÄpythonºÍdelphi°æ±¾Ò»Ö£© ÎÒÕâÀïÓÐp23-D6ºÍp24-D6. ÔÚ07-7-17£¬jason python.nbfan <python.nbfan在gmail.com> дµÀ£º > > dll£¬ºÜ¼òµ¥£¬2¸öº¯Êý´úÂëÈçÏ£º > library Project1; > > { Important note about DLL memory management: ShareMem must be the > first unit in your library's USES clause AND your project's (select > Project-View Source) USES clause if your DLL exports any procedures or > functions that pass strings as parameters or function results. This > applies to all strings passed to and from your DLL--even those that > are nested in records and classes. ShareMem is the interface unit to > the BORLNDMM.DLL shared memory manager, which must be deployed along > with your DLL. To avoid using BORLNDMM.DLL, pass string information > using PChar or ShortString parameters. } > > uses > SysUtils, > Classes; > > {$R *.RES} > function PlusNum(x,y:integer) :integer;stdcall; > begin > result:=x+y; > end; > > function MinusNum(x,y:integer) :integer;stdcall; > begin > result:=x-y; > end; > > exports > PlusNum index 1, > MinusNum index 2; > > > begin > end. > > > ÔÚpython shellÀïÕâÑùµ÷Óà > mydll=ctypes.cdll.LoadLibrary('project1.dll') > mydll.PlusNum(1,2) > > Ìáʾ³ö´í£¬ÇëÎʸÃÈçºÎµ÷Óã¿ > Traceback (most recent call last): > File "", line 1, in > ValueError: Procedure called with not enough arguments (8 bytes missing) > or wrong calling convention > _______________________________________________ > 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/20070718/45f27091/attachment.htm
2007年07月18日 星期三 08:46
自己研究出来了,直接用Func=ctypes.Windll(name) 就可以了。 Func.PlusNum(num,num) 这样就能调用dll中的函数。 但是help(Func)却看不见DLL里的函数。 在07-7-18,Samuel Chi <princeofdatamining at gmail.com> 写道: > > 要编写提供给python使用的dll,需要使用相关的Wrapper。 > 你google下PythonxxForDelphixx(要跟你的python和delphi版本一致) > 我这里有p23-D6和p24-D6. > > 在07-7-17,jason python.nbfan < python.nbfan at gmail.com> 写道: > > > > dll,很简单,2个函数代码如下: > > library Project1; > > > > { Important note about DLL memory management: ShareMem must be the > > first unit in your library's USES clause AND your project's (select > > Project-View Source) USES clause if your DLL exports any procedures or > > functions that pass strings as parameters or function results. This > > applies to all strings passed to and from your DLL--even those that > > are nested in records and classes. ShareMem is the interface unit to > > the BORLNDMM.DLL shared memory manager, which must be deployed along > > with your DLL. To avoid using BORLNDMM.DLL, pass string information > > using PChar or ShortString parameters. } > > > > uses > > SysUtils, > > Classes; > > > > {$R *.RES} > > function PlusNum(x,y:integer) :integer;stdcall; > > begin > > result:=x+y; > > end; > > > > function MinusNum(x,y:integer) :integer;stdcall; > > begin > > result:=x-y; > > end; > > > > exports > > PlusNum index 1, > > MinusNum index 2; > > > > > > begin > > end. > > > > > > 在python shell里这样调用 > > mydll=ctypes.cdll.LoadLibrary('project1.dll') > > mydll.PlusNum(1,2) > > > > 提示出错,请问该如何调用? > > Traceback (most recent call last): > > File "", line 1, in > > ValueError: Procedure called with not enough arguments (8 bytes missing) > > or wrong calling convention > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070718/8a109368/attachment.html
2007年07月18日 星期三 13:17
如何能直接看到调用DLL库里的函数列表呢? 在07-7-18,jason python.nbfan <python.nbfan at gmail.com> 写道: > > 自己研究出来了,直接用Func=ctypes.Windll(name) 就可以了。 > Func.PlusNum(num,num) 这样就能调用dll中的函数。 > > 但是help(Func)却看不见DLL里的函数。 > > 在07-7-18,Samuel Chi < princeofdatamining at gmail.com> 写道: > > > > 要编写提供给python使用的dll,需要使用相关的Wrapper。 > > 你google下PythonxxForDelphixx(要跟你的python和delphi版本一致) > > 我这里有p23-D6和p24-D6. > > > > 在07-7-17,jason python.nbfan < python.nbfan at gmail.com> 写道: > > > > > > dll,很简单,2个函数代码如下: > > > library Project1; > > > > > > { Important note about DLL memory management: ShareMem must be the > > > first unit in your library's USES clause AND your project's (select > > > Project-View Source) USES clause if your DLL exports any procedures > > > or > > > functions that pass strings as parameters or function results. This > > > applies to all strings passed to and from your DLL--even those that > > > are nested in records and classes. ShareMem is the interface unit to > > > the BORLNDMM.DLL shared memory manager, which must be deployed along > > > with your DLL. To avoid using BORLNDMM.DLL, pass string information > > > using PChar or ShortString parameters. } > > > > > > uses > > > SysUtils, > > > Classes; > > > > > > {$R *.RES} > > > function PlusNum(x,y:integer) :integer;stdcall; > > > begin > > > result:=x+y; > > > end; > > > > > > function MinusNum(x,y:integer) :integer;stdcall; > > > begin > > > result:=x-y; > > > end; > > > > > > exports > > > PlusNum index 1, > > > MinusNum index 2; > > > > > > > > > begin > > > end. > > > > > > > > > 在python shell里这样调用 > > > mydll=ctypes.cdll.LoadLibrary('project1.dll') > > > mydll.PlusNum(1,2) > > > > > > 提示出错,请问该如何调用? > > > Traceback (most recent call last): > > > File "", line 1, in > > > ValueError: Procedure called with not enough arguments (8 bytes > > > missing) or wrong calling convention > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070718/ac41518c/attachment.htm
2007年07月18日 星期三 13:42
ʵÏÖIAutomation ½Ó¿ÚºÃÏñÄܹ»²éѯCom ¶ÔÏóÖеĺ¯Êý£¬²»ÖªµÀ¶ÔÄãÓÐûÓÐÓᣠVB ¿Ø¼þ¶¼ÊÇʵÏÖIAutomation ½Ó¿ÚµÄ¡£ Èç¹ûÄãÕÒ²»µ½IAutomation ½Ó¿Ú£¬¿´¿´MSDNµÄActiveX¼¼Êõ°É£¬ÎÒ¶Ô´ËÒ²²»Êì £º£© ÔÚ07-7-18£¬jason python.nbfan <python.nbfan在gmail.com> дµÀ£º > > ÈçºÎÄÜÖ±½Ó¿´µ½µ÷ÓÃDLL¿âÀïµÄº¯ÊýÁбíÄØ£¿ > > ÔÚ07-7-18£¬jason python.nbfan <python.nbfan在gmail.com> дµÀ£º > > > > ×Ô¼ºÑо¿³öÀ´ÁË£¬Ö±½ÓÓÃFunc=ctypes.Windll(name) ¾Í¿ÉÒÔÁË¡£ > > Func.PlusNum(num,num) ÕâÑù¾ÍÄܵ÷ÓÃdllÖеĺ¯Êý¡£ > > > > µ«ÊÇhelp(Func)È´¿´²»¼ûDLLÀïµÄº¯Êý¡£ > > > > ÔÚ07-7-18£¬Samuel Chi < princeofdatamining在gmail.com> дµÀ£º > > > > > > Òª±àдÌṩ¸øpythonʹÓõÄdll£¬ÐèҪʹÓÃÏà¹ØµÄWrapper¡£ > > > ÄãgoogleÏÂPythonxxForDelphixx£¨Òª¸úÄãµÄpythonºÍdelphi°æ±¾Ò»Ö£© > > > ÎÒÕâÀïÓÐp23-D6ºÍp24-D6. > > > > > > ÔÚ07-7-17£¬jason python.nbfan < python.nbfan在gmail.com> дµÀ£º > > > > > > > > dll£¬ºÜ¼òµ¥£¬2¸öº¯Êý´úÂëÈçÏ£º > > > > library Project1; > > > > > > > > { Important note about DLL memory management: ShareMem must be the > > > > first unit in your library's USES clause AND your project's (select > > > > > > > > Project-View Source) USES clause if your DLL exports any > > > > procedures or > > > > functions that pass strings as parameters or function results.This > > > > applies to all strings passed to and from your DLL--even those > > > > that > > > > are nested in records and classes. ShareMem is the interface unit > > > > to > > > > the BORLNDMM.DLL shared memory manager, which must be deployed > > > > along > > > > with your DLL. To avoid using BORLNDMM.DLL, pass string > > > > information > > > > using PChar or ShortString parameters. } > > > > > > > > uses > > > > SysUtils, > > > > Classes; > > > > > > > > {$R *.RES} > > > > function PlusNum(x,y:integer) :integer;stdcall; > > > > begin > > > > result:=x+y; > > > > end; > > > > > > > > function MinusNum(x,y:integer) :integer;stdcall; > > > > begin > > > > result:=x-y; > > > > end; > > > > > > > > exports > > > > PlusNum index 1, > > > > MinusNum index 2; > > > > > > > > > > > > begin > > > > end. > > > > > > > > > > > > ÔÚpython shellÀïÕâÑùµ÷Óà > > > > mydll=ctypes.cdll.LoadLibrary('project1.dll') > > > > mydll.PlusNum(1,2) > > > > > > > > Ìáʾ³ö´í£¬ÇëÎʸÃÈçºÎµ÷Óã¿ > > > > Traceback (most recent call last): > > > > File "", line 1, in > > > > ValueError: Procedure called with not enough arguments (8 bytes > > > > missing) or wrong calling convention > > > > _______________________________________________ > > > > 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 > -- powered by python -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070718/871b1851/attachment-0001.html
2007年07月19日 星期四 08:53
有没有相关ctypes的说明?介绍?教程?帮助里的介绍太少了.... 在07-7-18,Alex Cheng <chengxin1985 at gmail.com> 写道: > > 实现IAutomation 接口好像能够查询Com 对象中的函数,不知道对你有没有用。 > VB 控件都是实现IAutomation 接口的。 如果你找不到IAutomation 接口,看看MSDN的ActiveX技术吧,我对此也不熟 :) > > > 在07-7-18,jason python.nbfan < python.nbfan at gmail.com> 写道: > > > > 如何能直接看到调用DLL库里的函数列表呢? > > > > 在07-7-18,jason python.nbfan <python.nbfan at gmail.com > 写道: > > > > > > 自己研究出来了,直接用Func=ctypes.Windll(name) 就可以了。 > > > Func.PlusNum(num,num) 这样就能调用dll中的函数。 > > > > > > 但是help(Func)却看不见DLL里的函数。 > > > > > > 在07-7-18,Samuel Chi < princeofdatamining at gmail.com> 写道: > > > > > > > > 要编写提供给python使用的dll,需要使用相关的Wrapper。 > > > > 你google下PythonxxForDelphixx(要跟你的python和delphi版本一致) > > > > 我这里有p23-D6和p24-D6. > > > > > > > > 在07-7-17,jason python.nbfan < python.nbfan at gmail.com> 写道: > > > > > > > > > > dll,很简单,2个函数代码如下: > > > > > library Project1; > > > > > > > > > > { Important note about DLL memory management: ShareMem must be the > > > > > first unit in your library's USES clause AND your project's (select > > > > > > > > > > Project-View Source) USES clause if your DLL exports any > > > > > procedures or > > > > > functions that pass strings as parameters or function results.This > > > > > applies to all strings passed to and from your DLL--even those > > > > > that > > > > > are nested in records and classes. ShareMem is the interface > > > > > unit to > > > > > the BORLNDMM.DLL shared memory manager, which must be deployed > > > > > along > > > > > with your DLL. To avoid using BORLNDMM.DLL, pass string > > > > > information > > > > > using PChar or ShortString parameters. } > > > > > > > > > > uses > > > > > SysUtils, > > > > > Classes; > > > > > > > > > > {$R *.RES} > > > > > function PlusNum(x,y:integer) :integer;stdcall; > > > > > begin > > > > > result:=x+y; > > > > > end; > > > > > > > > > > function MinusNum(x,y:integer) :integer;stdcall; > > > > > begin > > > > > result:=x-y; > > > > > end; > > > > > > > > > > exports > > > > > PlusNum index 1, > > > > > MinusNum index 2; > > > > > > > > > > > > > > > begin > > > > > end. > > > > > > > > > > > > > > > 在python shell里这样调用 > > > > > mydll=ctypes.cdll.LoadLibrary('project1.dll') > > > > > mydll.PlusNum(1,2) > > > > > > > > > > 提示出错,请问该如何调用? > > > > > Traceback (most recent call last): > > > > > File "", line 1, in > > > > > ValueError: Procedure called with not enough arguments (8 bytes > > > > > missing) or wrong calling convention > > > > > _______________________________________________ > > > > > python-chinese > > > > > Post: send python-chinese at lists.python.cn > > > > > Subscribe: send subscribe to > > > > > python-chinese-request at lists.python.cn > > > > > Unsubscribe: send unsubscribe to > > > > > python-chinese-request at lists.python.cn > > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to > > > > python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > -- > powered by python > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070719/c3b19118/attachment.html
Zeuux © 2025
京ICP备05028076号