myPythonClient
(以下)関数を呼び出したいringBell
(を使用してDLLからロードされるctypes
)。ただし、ringBell
その名前でアクセスしようとすると、が発生しますAttributeError
。なんで?
RingBell.h
含む
namespace MyNamespace
{
class MyClass
{
public:
static __declspec(dllexport) int ringBell ( void ) ;
} ;
}
RingBell.cpp
含む
#include <iostream>
#include "RingBell.h"
namespace MyNamespace
{
int __cdecl MyClass::ringBell ( void )
{
std::cout << "\a" ;
return 0 ;
}
}
myPythonClient.py
含む
from ctypes import *
cdll.RingBell[1]() # this invocation works fine
cdll.RingBell.ringBell() # however, this invocation errors out
# AttributeError: function 'ringBell' not found