views:

362

answers:

3

So I have a function in vb that is converted to a dll that I want to use in python. However trying to use it, I get an error message this is the VB function

Function DISPLAYNAME(Name)
MsgBox ("Hello " & Name & "!")
End Function

and this is how I call it in python

from ctypes import *
test = windll.TestDLL
print test
print test.DISPLAYNAME("one")

But I get errors so what is the right way of calling the dll

Traceback (most recent call last):
  File "C:\Test\testdll.py", line 4, in <module>
    print test.DISPLAYNAME("one")
  File "C:\Python26\lib\ctypes\__init__.py", line 366, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python26\lib\ctypes\__init__.py", line 371, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'DISPLAYNAME' not found

I have been looking around online but no solution so far. Can't use cdll since this is for c progs.

I have looked at some of the python and dll related questions but no solution so far works for my issue.

+1  A: 

I dunno the answer to your specific question, but if it's VB.NET, you can natively call it in IronPython.

Dustin Getz
A: 

It might be a scoping issue, with out the Public access modifier, the function may not be visible to external callers. Try

Public Function DISPLAYNAME(Name)
MsgBox ("Hello " & Name & "!")
End Function

in your dll

cmsjr
A: 

http://arcscripts.esri.com/scripts.asp?eLang=&amp;eProd=&amp;perPage=10&amp;eQuery=areal&amp;Submit2=Search

Have you tried calling areal interpolation?

Regards.

David

david