Wrapper for libeay32.dll: how to import macro?
Question: I'm writing small wrapper for OpenSLL `libeay32.dll` in Python. For majority
of functions it is possible to import them as follows:

    
    
    self.Function_Name = self._dll.Function_Name
    self.Function_Name.restype = ctypes.c_int #for example
    self.Function_Name.argtypes = [list of ctypes arguments]
    

Unfortunately I'm not able to import this way any macros:

`X509_get_notAfter`, `X509_get_notBefore` etc.

Any ideas, how to do it with `ctypes`?


Answer: You can't import macros. What you're importing are functions from a DLL.
Macros aren't exported from the DLL, so there's nothing to import.

Fortunately, most macros are very simple, so you can just reimplement them in
Python.

Or, alternatively, create a wrapper DLL in C that defines a function for each
macro, compile and link that, and import the wrapper functions with `ctypes`.

Or you may want to use [`Cython`](http://www.cython.org) or some other
technology instead of `ctypes`. The way they generally work is to generate and
compile C code that wraps the C library and exports Python types and
functions, and it's generally as easy to export a C macro as a Python function
as it is to export a C function.

Or, simplest of all… does [PyOpenSSL](https://pypi.python.org/pypi/pyOpenSSL)
already wrap everything you need?

