首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 其他开发语言 >

Python在windows上载入dll,异常

2012-07-27 
Python在windows上载入dll,错误from ctypes import *import os, os.path, time, gcimport xml.dom.minidom

Python在windows上载入dll,错误
from ctypes import *
import os, os.path, time, gc
import xml.dom.minidom
import xml.etree.ElementTree as ET

time.clock()

dll = cdll.LoadLibrary(r'C:\Program Files\XXX.dll') 


SLN = getattr(dll,'SLN')  


SRNS = getattr(dll, 'SRNS') 

Instant = create_string_buffer('\000' * 1000000)  

XML = r'C:\Documents and Settings\xxy.xml'

os.chdir( os.path.dirname(XML) )  
 
if SLN( XML )!=1 :  
  print 'Erreur de chargement'
  exit()  

bSFin = c_int(0)  
print "bSFin:%s" % bSFin

while bSFin.value == 0 :  
  if SRNS( Instant, 1, byref(bSFin) )!=1:
  print 'Erreur de simulation'
  exit()

错误
SLN: 载入时出错
SRNS: WindowsError: exception: access violation reading 0x00000000

[解决办法]
SLN: 载入时出错

是不是dll = cdll.LoadLibrary(r'C:\Program Files\XXX.dll') 这句有问题
你在下面加个print dll看看能不能打印出来dll对象,是否加载成功

热点排行