I am trying to create a dll in VB that will be visible to python,
none of the VB functions is displayed when I import a dll in python
That's what I'm doing:
Public Class MyFunctions
Public Function AddMyValues(ByVal Value1 As Double, ByVal Value2 As Double)
Dim Result As Double
Result = Value1 + Value2
Return Result
End Function
End Class`
I save it as a dll (Build from Visual Studio 2010)
I try, if it works, importing it into the othoer VB project (it works fine):
Imports ClassLibrary1
Module Module1
Sub Main()
Dim Nowa As New ClassLibrary1.MyFunctions
Dim Result As String
Result = Nowa.AddMyValues(123, 456.78).ToString
Console.WriteLine(Result)
Console.ReadLine()
End Sub
End Module
- I load it in python and try to use it:
from ctypes import *
MojaDLL = cdll.LoadLibrary("E:\\ClassLibrary1.dll")
MojaDLL.MyFunctions
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python25\lib\ctypes\__init__.py", line 361, in __getattr__
func = self.__getitem__(name)
File "C:\Python25\lib\ctypes\__init__.py", line 366, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'MyFunctions' not found
instead MyDll.MyFunctions I also tried: MyDll.MyFunctions() , MyDll.MyFunctions.AddMyValues(1,2) , MyDll.MyFunctions.AddMyValues.
What is wrong here? I do not understand this.
PS. there is a similar unresolved issue: calling vb dll in python
source
share