Hi, I'm trying to call my own C function from a small RPython program. When I 
try to build the program I see this error:

[translation:ERROR] Exception: stand-alone program entry point must return an 
int (and not, e.g., None or always raise an exception).

This is the entire RPython program:

from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.translator.tool.cbuild import ExternalCompilationInfo

info = ExternalCompilationInfo(includes=["./myheader.h"], 
libraries=["./my_functions.so"])
print_thread_mode = rffi.llexternal("print_thread_mode", [lltype.Void], 
lltype.Void, compilation_info=info)

def entry_point(argv):
    print_thread_mode()
    return 0

def target(*args):
    return entry_point


The entry_point function is returning an int (0 here). If I remove the call to 
print_thread_mode() the program compiles. The C function is declared in a .c 
file. I compiled that file to .so and was able to use it using ctypes in 
CPython. This is its prototype: void print_thread_mode(void). It simply prints 
some text.

Is there something I am missing?
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to