Beispiel #1
0
from . import boehmlib
from flypy.extern_support import extern_cffi

__all__ = ['gc_alloc']

root = os.path.dirname(os.path.abspath(__file__))
lib = os.path.join(root, "boehmlib.so")

#===------------------------------------------------------------------===
# Decls
#===------------------------------------------------------------------===

gc, gclib_cffi = extern_cffi(
    ".flypy.runtime.gc", lib, """
void boehm_collect();
void *boehm_malloc(size_t nbytes);
void boehm_disable();
void boehm_enable();
void boehm_register_finalizer(void *obj, void *dtor);
""")

# We can't take the address of these :(

#gc = ffi.verify("""
##include <gc.h>
#
#void boehm_init(void) {
#    GC_INIT();
#}
#
#void boehm_collect(void) {
#    GC_gcollect();
Beispiel #2
0
# -*- coding: utf-8 -*-
"""
C library bindings.
"""

from __future__ import print_function, division, absolute_import

from flypy.extern_support import extern_cffi

#===------------------------------------------------------------------===
# Decls
#===------------------------------------------------------------------===

libc, libc_cffi = extern_cffi(
    ".flypy.runtime.c", None, """
void *malloc(size_t size);
void *realloc(void *ptr, size_t size);
void free(void *ptr);
int memcmp(void *s1, void *s2, size_t n);
int printf(char *s, ...);
int snprintf(char *str, size_t size, const char *format, ...);
int puts(char *s);
size_t strlen(char *s);
unsigned long clock();
""")
Beispiel #3
0
__all__ = ["gc_alloc"]

root = os.path.dirname(os.path.abspath(__file__))
lib = os.path.join(root, "boehmlib.so")

# ===------------------------------------------------------------------===
# Decls
# ===------------------------------------------------------------------===

gc, gclib_cffi = extern_cffi(
    ".flypy.runtime.gc",
    lib,
    """
void boehm_collect();
void *boehm_malloc(size_t nbytes);
void boehm_disable();
void boehm_enable();
void boehm_register_finalizer(void *obj, void *dtor);
""",
)


# We can't take the address of these :(

# gc = ffi.verify("""
##include <gc.h>
#
# void boehm_init(void) {
#    GC_INIT();
# }
Beispiel #4
0
# -*- coding: utf-8 -*-

"""
C library bindings.
"""

from __future__ import print_function, division, absolute_import

from flypy.extern_support import extern_cffi

#===------------------------------------------------------------------===
# Decls
#===------------------------------------------------------------------===

libc, libc_cffi = extern_cffi(".flypy.runtime.c", None, """
void *malloc(size_t size);
void *realloc(void *ptr, size_t size);
void free(void *ptr);
int memcmp(void *s1, void *s2, size_t n);
int printf(char *s, ...);
int snprintf(char *str, size_t size, const char *format, ...);
int puts(char *s);
size_t strlen(char *s);
unsigned long clock();
""")