当前位置: 代码迷 >> 其他开发语言 >> Python在windows上载入dll,异常
  详细解决方案

Python在windows上载入dll,异常

热度:1565   发布时间:2013-02-26 00:00:00.0
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对象,是否加载成功
  相关解决方案