Python: acceso a la función DLL utilizando ctypes - acceso por función * nombre * falla

myPythonClient (abajo) quiere invocar unringBell función (cargada desde una DLL usandoctypes). Sin embargo, intentar accederringBell a través de sunombre resulta en unAttributeError. ¿Por qué?

RingBell.h contiene

namespace MyNamespace
    {
    class MyClass
        {
        public:
            static __declspec(dllexport) int ringBell ( void ) ;
        } ;
    }

RingBell.cpp contiene

#include <iostream>
#include "RingBell.h"
namespace MyNamespace
    {
    int __cdecl MyClass::ringBell ( void )
        {
        std::cout << "\a" ;
        return 0 ;
        }
    }

myPythonClient.py contiene

from ctypes import *
cdll.RingBell[1]() # this invocation works fine
cdll.RingBell.ringBell() # however, this invocation errors out
# AttributeError: function 'ringBell' not found

Respuestas a la pregunta(3)

Su respuesta a la pregunta