import os
from ctypeslib.dynamic_module import include
from ctypes import *

_gen_basename = include("#include <windows.h>", persist=False, compilerflags=["-DWIN32_LEAN_AND_MEAN"])
Exemple #2
0
 def test_compiler_errors(self):
     from ctypeslib.codegen.cparser import CompilerError
     from ctypeslib.dynamic_module import include
     self.failUnlessRaises(CompilerError, lambda: include("#error"))
Exemple #3
0
import os
from ctypeslib.dynamic_module import include
from ctypes import *

if os.name == "nt":
    _libc = CDLL("msvcrt")
else:
    _libc = CDLL(None)

_gen_basename = include("""\
#include <stdio.h>

#ifdef _MSC_VER
#  include <fcntl.h>
#else
#  include <sys/fcntl.h>
#endif

/* Silly comment */
""",
                        persist=False)
Exemple #4
0
import os
from ctypeslib.dynamic_module import include
from ctypes import *

if os.name == "nt":
    _libc = CDLL("msvcrt")
else:
    _libc = CDLL(None)

_gen_basename = include("""\
#include <stdio.h>

#ifdef _MSC_VER
#  include <fcntl.h>
#else
#  include <sys/fcntl.h>
#endif

/* Silly comment */
""",
        persist=False)
Exemple #5
0
from cpptypes import *

mydll = AnyDLL("mydll.dll")

################################################################
if __debug__:
    from ctypeslib.dynamic_module import include
    include('''
    #include "mydll.h"
    ''',
            compilerflags=["-I."],
            persist=True)

################################################################
# everything below this line is autogenerated on demand, by the
# ctypeslib code generator (you need the ctypeslib-cpp branch for
# that):
STRING = c_char_p
class CSimpleClass(Class):
    _realname_ = 'CSimpleClass'
class COLOR(Structure):
    pass
COLOR._fields_ = [
    ('red', c_int),
    ('green', c_int),
    ('blue', c_int),
    ('alpha', c_int),
]
class color(Structure):
    pass
color._fields_ = [