Python calls DLL questions

xiaoxiao2021-03-06  42

Sender: INSMNIA (Garfield), the letter area: Python Title: Python calls DLL questions ask the letter station: BBS Shuimu Tsinghua Station (Fri Aug 6 09:19:43 2004), transfer

Background: Python 2.3.3, CTypes 0.9.0, Matlab R14 Objective: To use Python as "adhesive" to combine the programs (* .m) of existing MATLABs through graphic GUI. Procedure: (for example) matlab function is as follows: function y = foo (x) y = x 1 then performs the following compile command mcc -w lib: foolib -lc -t -t link: lib foo.m generates the following batch file FOOLIB .C, FOOLIB.CTF, FOOLIB.DLL, FOOLIB.EXP, FOOLIB.EXPORTS, FOOLIB.H, FOOLIB.LIB, FOOLIB_MCC_COMPONENT_DATA.C Copies all of the above files into the Python directory, and the python command can be successfully executed as follows >> from ctypes Import * >>> cdll.foolib

But the following command failed >>> CDLL.FOOLIB (14) Traceback (MOST Recent Call Last): File "

", LINE 1, in -toplevel-

CDLL.FOOLIB (14)

AttributeError: CDLL Instance Has NO __CALL__METHOD

Question: How do I use the function in the DLL in Python? thank you very much!

-

※ Modification: · Insomnia in AUG 6 09:28:02 2004 Modified this article · [From: 218.1.160. *] ※ Modified: · INSMNIA in Aug 6 09:32:48 2004 Modified this article · [from: 218.1.160. *] ※ Modification: · INSMNIA in AUG 6 09:34:21 2004 Modified this article · [From: 218.1.160. *] ※ Source: · BBS Shuimu Tsinghua Station http://smth.org · [From: 218.110 *] *]

Copyright Notice: 9CBS is this BLOG managed service provider. If this paper involves copyright issues, 9CBS does not assume relevant responsibilities, please contact the copyright owner directly with the article Author.

[

Click here to favor this article]

Published on August 21, 2004 6:13 PM

FEEDBACK

# 回: Python calls DLL questions should be teach 2004-11-30 10:29 AM Mei Jinsong

Use ctypes to call http://blog.9cbs.net/yuanqingfei/articles/81003.aspx Focus on the usage of ctypes in Python! !

转载请注明原文地址:https://www.9cbs.com/read-55887.html

New Post(0)