1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-04 18:29:19 +02:00

do some string conversions less hackish and address one review comment on how to call the callback and return results

This commit is contained in:
holger krekel 2018-09-06 16:28:27 +02:00
parent aab06cda70
commit 1ff06c071b
4 changed files with 56 additions and 23 deletions

View file

@ -29,12 +29,31 @@ def ffibuilder():
'deltachat.capi',
"""
#include <deltachat/deltachat.h>
const char * dupstring_helper(const char* string)
{
return strdup(string);
}
int dc_get_event_signature_types(int e)
{
int result = 0;
if (DC_EVENT_DATA1_IS_STRING(e))
result |= 1;
if (DC_EVENT_DATA2_IS_STRING(e))
result |= 2;
if (DC_EVENT_RETURNS_STRING(e))
result |= 4;
if (DC_EVENT_RETURNS_INT(e))
result |= 8;
return result;
}
""",
libraries=['deltachat'],
)
builder.cdef("""
typedef int... time_t;
void free(void *ptr);
extern const char * dupstring_helper(const char* string);
extern int dc_get_event_signature_types(int);
""")
cc = distutils.ccompiler.new_compiler(force=True)
distutils.sysconfig.customize_compiler(cc)