Work on cURL, fix compilation without HashLink

This commit is contained in:
Joshua Granick
2018-06-20 16:47:52 -07:00
parent c265c75372
commit 831c619c0b
2 changed files with 246 additions and 110 deletions

View File

@@ -19,23 +19,21 @@ namespace lime {
curl_off_t ultotal;
curl_off_t ulnow;
}
};
std::map<void*, void*> curlMultiHandles;
std::map<void*, CURLM*> curlMultiHandles;
std::map<void*, int> curlMultiRunningHandles;
std::map<void*, bool> curlMultiValid;
std::map<CURL*, void*> curlObjects;
std::map<void*, bool> curlValid;
std::map<void*, AutoGCRoot*> headerCallbacks;
std::map<void*, curl_slist*> headerSLists;
std::map<void*, AutoGCRoot*> progressCallbacks;
std::map<CURL*, AutoGCRoot*> progressCallbacks;
std::map<CURL*, CURLProgress*> progressValues;
std::map<CURL*, std::stringbuf*> readBuffers;
std::map<void*, AutoGCRoot*> readCallbacks;
std::map<CURL*, AutoGCRoot*> readCallbacks;
std::map<CURL*, std::stringbuf*> writeBuffers;
std::map<AutoGCRoot*, Bytes*> writeBytes;
std::map<AutoGCRoot*, AutoGCRoot*> writeBytesRoot;
std::map<void*, AutoGCRoot*> writeCallbacks;
std::map<CURL*, AutoGCRoot*> writeCallbacks;
Mutex curl_gc_mutex;
@@ -69,17 +67,17 @@ namespace lime {
callback = headerCallbacks[handle];
if (writeBytes.find (callback) != writeBytes.end ()) {
// if (writeBytes.find (callback) != writeBytes.end ()) {
Bytes* _writeBytes = writeBytes[callback];
delete _writeBytes;
writeBytes.erase (callback);
// Bytes* _writeBytes = writeBytes[callback];
// delete _writeBytes;
// writeBytes.erase (callback);
AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
delete _writeBytesRoot;
writeBytesRoot.erase (callback);
// AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
// delete _writeBytesRoot;
// writeBytesRoot.erase (callback);
}
// }
headerCallbacks.erase (handle);
delete callback;
@@ -114,17 +112,17 @@ namespace lime {
callback = writeCallbacks[handle];
if (writeBytes.find (callback) != writeBytes.end ()) {
// if (writeBytes.find (callback) != writeBytes.end ()) {
Bytes* _writeBytes = writeBytes[callback];
delete _writeBytes;
writeBytes.erase (callback);
// Bytes* _writeBytes = writeBytes[callback];
// delete _writeBytes;
// writeBytes.erase (callback);
AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
delete _writeBytesRoot;
writeBytesRoot.erase (callback);
// AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
// delete _writeBytesRoot;
// writeBytesRoot.erase (callback);
}
// }
writeCallbacks.erase (handle);
delete callback;
@@ -178,17 +176,17 @@ namespace lime {
callback = headerCallbacks[handle];
if (writeBytes.find (callback) != writeBytes.end ()) {
// if (writeBytes.find (callback) != writeBytes.end ()) {
Bytes* _writeBytes = writeBytes[callback];
delete _writeBytes;
writeBytes.erase (callback);
// Bytes* _writeBytes = writeBytes[callback];
// delete _writeBytes;
// writeBytes.erase (callback);
AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
delete _writeBytesRoot;
writeBytesRoot.erase (callback);
// AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
// delete _writeBytesRoot;
// writeBytesRoot.erase (callback);
}
// }
headerCallbacks.erase (handle);
delete callback;
@@ -223,17 +221,17 @@ namespace lime {
callback = writeCallbacks[handle];
if (writeBytes.find (callback) != writeBytes.end ()) {
// if (writeBytes.find (callback) != writeBytes.end ()) {
Bytes* _writeBytes = writeBytes[callback];
delete _writeBytes;
writeBytes.erase (callback);
// Bytes* _writeBytes = writeBytes[callback];
// delete _writeBytes;
// writeBytes.erase (callback);
AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
delete _writeBytesRoot;
writeBytesRoot.erase (callback);
// AutoGCRoot* _writeBytesRoot = writeBytesRoot[callback];
// delete _writeBytesRoot;
// writeBytesRoot.erase (callback);
}
// }
writeCallbacks.erase (handle);
delete callback;
@@ -364,13 +362,13 @@ namespace lime {
curlObjects[dup] = duphandle;
AutoGCRoot* callback;
Bytes* _writeBytes;
// Bytes* _writeBytes;
if (headerCallbacks.find (handle) != headerCallbacks.end ()) {
callback = headerCallbacks[handle];
// _writeBytes = new Bytes (1024);
writeBytes[callback] = _writeBytes;
writeBytesRoot[callback] = new AutoGCRoot ((value)_writeBytes->Value ());
// writeBytes[callback] = _writeBytes;
// writeBytesRoot[callback] = new AutoGCRoot ((value)_writeBytes->Value ());
headerCallbacks[duphandle] = new AutoGCRoot (headerCallbacks[handle]->get());
}
@@ -385,8 +383,8 @@ namespace lime {
if (writeCallbacks.find (handle) != writeCallbacks.end ()) {
callback = writeCallbacks[handle];
// _writeBytes = new Bytes (1024);
writeBytes[callback] = _writeBytes;
writeBytesRoot[callback] = new AutoGCRoot ((value)_writeBytes->Value ());
// writeBytes[callback] = _writeBytes;
// writeBytesRoot[callback] = new AutoGCRoot ((value)_writeBytes->Value ());
writeCallbacks[duphandle] = new AutoGCRoot (writeCallbacks[handle]->get());
}
@@ -461,14 +459,56 @@ namespace lime {
curl_gc_mutex.Lock ();
CURL* curl = (CURL*)val_data (easy_handle);
int code;
if (progressCallbacks.find (curl) != progressCallbacks.end ()) {
CURLProgress* progress = progressValues[curl];
value vals[] = {
alloc_float (progress->dltotal),
alloc_float (progress->dlnow),
alloc_float (progress->ultotal),
alloc_float (progress->ulnow),
};
code = val_int (val_callN (progressCallbacks[curl]->get (), vals, 4));
if (code != 0) {
// TODO: Abort
}
}
if (readCallbacks.find (curl) != readCallbacks.end ()) {
std::stringbuf* readBuffer = readBuffers[curl];
// TODO
// if (buffer->in_avail () > 0) {
// Bytes bytes;
// bytes.Set (val_call1 (readCallbacks[curl]->get (), alloc_int (length)));
// if (bytes.Length () <= length) length = bytes.Length ();
// memcpy (buffer, bytes.Data (), length);
// }
}
if (writeBuffers.find (curl) != writeBuffers.end ()) {
std::stringbuf* buffer = writeBuffers[curl];
if (buffer->in_avail > 0) {
if (buffer->in_avail () > 0) {
if (writeBytes.find (curl) != writeBytes.end ()) {
if (writeCallbacks.find (curl) != writeCallbacks.end ()) {
int size = 0;
@@ -487,19 +527,6 @@ namespace lime {
}
HL_PRIM void hl_lime_curl_easy_perform (HL_CFFIPointer* easy_handle) {
int code;
System::GCEnterBlocking ();
code = curl_easy_perform ((CURL*)easy_handle->ptr);
System::GCExitBlocking ();
return code;
}
value lime_curl_easy_getinfo (value curl, int info) {
CURLcode code = CURLE_OK;
@@ -908,6 +935,8 @@ namespace lime {
static size_t write_callback (void *ptr, size_t size, size_t nmemb, void *userp) {
// PHP: cURL, string to be written
CURL* easy_handle = (CURL*)userp;
std::stringbuf* buffer = writeBuffers[easy_handle];
@@ -917,7 +946,7 @@ namespace lime {
}
buffer->putn (ptr, size * nmemb);
buffer->sputn ((char*)ptr, size * nmemb);
return size * nmemb;
}
@@ -925,15 +954,17 @@ namespace lime {
static size_t read_callback (void *buffer, size_t size, size_t nmemb, void *userp) {
// PHP: cURL, string stream (using CURLOPT_INFILE, not defined in standard cURL API, use haxe.io.Input?), max size
CURL* easy_handle = (CURL*)userp;
std::stringbuf* readBuffer = readBuffers[easy_handle];
size_t length = size * nmemb;
if (length > readBuffer->in_avail) length = readBuffer->in_avail;
if (length > readBuffer->in_avail ()) length = readBuffer->in_avail ();
if (length > 0) {
readBuffer->sgetn (buffer, length);
readBuffer->sgetn ((char*)buffer, length);
}
@@ -958,7 +989,7 @@ namespace lime {
int lime_curl_easy_setopt (value handle, int option, value parameter, value bytes) {
CURLcode code = CURLE_OK;
CURL* curl = (CURL*)val_data(handle);
CURL* easy_handle = (CURL*)val_data(handle);
CURLoption type = (CURLoption)option;
switch (type) {
@@ -1013,7 +1044,7 @@ namespace lime {
case CURLOPT_SUPPRESS_CONNECT_HEADERS:
case CURLOPT_SSH_COMPRESSION:
code = curl_easy_setopt (curl, type, val_bool (parameter));
code = curl_easy_setopt (easy_handle, type, val_bool (parameter));
break;
case CURLOPT_SSL_VERIFYHOST:
@@ -1079,7 +1110,7 @@ namespace lime {
case CURLOPT_PROXY_SSL_OPTIONS:
case CURLOPT_SOCKS5_AUTH:
code = curl_easy_setopt (curl, type, val_int (parameter));
code = curl_easy_setopt (easy_handle, type, val_int (parameter));
break;
case CURLOPT_POSTFIELDSIZE_LARGE:
@@ -1089,7 +1120,7 @@ namespace lime {
case CURLOPT_MAX_SEND_SPEED_LARGE:
case CURLOPT_MAX_RECV_SPEED_LARGE:
code = curl_easy_setopt (curl, type, val_float (parameter));
code = curl_easy_setopt (easy_handle, type, val_float (parameter));
break;
case CURLOPT_ERRORBUFFER:
@@ -1171,7 +1202,7 @@ namespace lime {
case CURLOPT_ABSTRACT_UNIX_SOCKET:
case CURLOPT_REQUEST_TARGET:
code = curl_easy_setopt (curl, type, val_string (parameter));
code = curl_easy_setopt (easy_handle, type, val_string (parameter));
break;
case CURLOPT_IOCTLFUNCTION:
@@ -1184,8 +1215,6 @@ namespace lime {
case CURLOPT_OPENSOCKETDATA:
case CURLOPT_CLOSESOCKETFUNCTION:
case CURLOPT_CLOSESOCKETDATA:
case CURLOPT_XFERINFOFUNCTION:
//case CURLOPT_XFERINFODATA:
case CURLOPT_DEBUGFUNCTION:
case CURLOPT_DEBUGDATA:
case CURLOPT_SSL_CTX_FUNCTION:
@@ -1231,9 +1260,9 @@ namespace lime {
{
curl_gc_mutex.Lock ();
AutoGCRoot* callback = new AutoGCRoot (parameter);
readCallbacks[handle] = callback;
code = curl_easy_setopt (curl, type, read_callback);
curl_easy_setopt (curl, CURLOPT_READDATA, callback);
readCallbacks[easy_handle] = callback;
code = curl_easy_setopt (easy_handle, type, read_callback);
curl_easy_setopt (easy_handle, CURLOPT_READDATA, easy_handle);
curl_gc_mutex.Unlock ();
break;
}
@@ -1241,12 +1270,9 @@ namespace lime {
{
curl_gc_mutex.Lock ();
AutoGCRoot* callback = new AutoGCRoot (parameter);
writeCallbacks[handle] = callback;
Bytes* _writeBytes = new Bytes (bytes);
writeBytes[callback] = _writeBytes;
writeBytesRoot[callback] = new AutoGCRoot (bytes);
code = curl_easy_setopt (curl, type, write_callback);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, callback);
writeCallbacks[easy_handle] = callback;
code = curl_easy_setopt (easy_handle, type, write_callback);
curl_easy_setopt (easy_handle, CURLOPT_WRITEDATA, easy_handle);
curl_gc_mutex.Unlock ();
break;
}
@@ -1254,25 +1280,23 @@ namespace lime {
{
curl_gc_mutex.Lock ();
AutoGCRoot* callback = new AutoGCRoot (parameter);
headerCallbacks[handle] = callback;
Bytes* _writeBytes = new Bytes (bytes);
writeBytes[callback] = _writeBytes;
writeBytesRoot[callback] = new AutoGCRoot (bytes);
code = curl_easy_setopt (curl, type, write_callback);
curl_easy_setopt (curl, CURLOPT_HEADERDATA, callback);
headerCallbacks[easy_handle] = callback;
code = curl_easy_setopt (easy_handle, type, write_callback);
curl_easy_setopt (easy_handle, CURLOPT_HEADERDATA, easy_handle);
curl_gc_mutex.Unlock ();
break;
}
case CURLOPT_PROGRESSFUNCTION:
case CURLOPT_XFERINFOFUNCTION:
{
// TODO: Use XFERINFO instead
curl_gc_mutex.Lock ();
AutoGCRoot* callback = new AutoGCRoot (parameter);
progressCallbacks[handle] = callback;
code = curl_easy_setopt (curl, type, progress_callback);
curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, callback);
curl_easy_setopt (curl, CURLOPT_NOPROGRESS, false);
progressCallbacks[easy_handle] = callback;
code = curl_easy_setopt (easy_handle, CURLOPT_XFERINFOFUNCTION, progress_callback);
curl_easy_setopt (easy_handle, CURLOPT_XFERINFODATA, easy_handle);
curl_easy_setopt (easy_handle, CURLOPT_NOPROGRESS, false);
curl_gc_mutex.Unlock ();
break;
}
@@ -1280,6 +1304,7 @@ namespace lime {
case CURLOPT_HTTPHEADER:
{
curl_gc_mutex.Lock ();
if (headerSLists.find (handle) != headerSLists.end ()) {
curl_slist_free_all (headerSLists[handle]);
@@ -1297,7 +1322,7 @@ namespace lime {
headerSLists[handle] = chunk;
code = curl_easy_setopt (curl, type, chunk);
code = curl_easy_setopt (easy_handle, type, chunk);
curl_gc_mutex.Unlock ();
break;
}
@@ -1316,7 +1341,7 @@ namespace lime {
HL_PRIM int hl_lime_curl_easy_setopt (HL_CFFIPointer* handle, int option, vdynamic* parameter, Bytes* bytes) {
CURLcode code = CURLE_OK;
CURL* curl = (CURL*)handle->ptr;
CURL* easy_handle = (CURL*)handle->ptr;
CURLoption type = (CURLoption)option;
switch (type) {
@@ -1371,7 +1396,7 @@ namespace lime {
case CURLOPT_SUPPRESS_CONNECT_HEADERS:
case CURLOPT_SSH_COMPRESSION:
code = curl_easy_setopt (curl, type, parameter->v.b);
code = curl_easy_setopt (easy_handle, type, parameter->v.b);
break;
case CURLOPT_SSL_VERIFYHOST:
@@ -1437,7 +1462,7 @@ namespace lime {
case CURLOPT_PROXY_SSL_OPTIONS:
case CURLOPT_SOCKS5_AUTH:
code = curl_easy_setopt (curl, type, parameter->v.i);
code = curl_easy_setopt (easy_handle, type, parameter->v.i);
break;
case CURLOPT_POSTFIELDSIZE_LARGE:
@@ -1447,7 +1472,7 @@ namespace lime {
case CURLOPT_MAX_SEND_SPEED_LARGE:
case CURLOPT_MAX_RECV_SPEED_LARGE:
code = curl_easy_setopt (curl, type, parameter->v.f);
code = curl_easy_setopt (easy_handle, type, parameter->v.f);
break;
case CURLOPT_ERRORBUFFER:
@@ -1529,7 +1554,7 @@ namespace lime {
case CURLOPT_ABSTRACT_UNIX_SOCKET:
case CURLOPT_REQUEST_TARGET:
code = curl_easy_setopt (curl, type, hl_to_utf8 ((const uchar*)parameter->v.bytes));
code = curl_easy_setopt (easy_handle, type, hl_to_utf8 ((const uchar*)parameter->v.bytes));
break;
case CURLOPT_IOCTLFUNCTION:
@@ -1542,8 +1567,6 @@ namespace lime {
case CURLOPT_OPENSOCKETDATA:
case CURLOPT_CLOSESOCKETFUNCTION:
case CURLOPT_CLOSESOCKETDATA:
case CURLOPT_XFERINFOFUNCTION:
//case CURLOPT_XFERINFODATA:
case CURLOPT_DEBUGFUNCTION:
case CURLOPT_DEBUGDATA:
case CURLOPT_SSL_CTX_FUNCTION:

View File

@@ -3,37 +3,150 @@
#ifndef LIME_HASHLINK
HL_API hl_type hlt_void = hl_type ();
HL_API hl_type hlt_i32 = hl_type ();
HL_API hl_type hlt_i64 = hl_type ();
HL_API hl_type hlt_f64 = hl_type ();
HL_API hl_type hlt_f32 = hl_type ();
HL_API hl_type hlt_dyn = hl_type ();
HL_API hl_type hlt_array = hl_type ();
HL_API hl_type hlt_bytes = hl_type ();
HL_API hl_type hlt_dynobj = hl_type ();
HL_API hl_type hlt_bool = hl_type ();
HL_API hl_type hlt_abstract = hl_type ();
HL_API int hl_type_size( hl_type *t ) { return 0; }
HL_API int hl_pad_struct( int size, hl_type *t ) { return 0; }
HL_API hl_runtime_obj *hl_get_obj_rt( hl_type *ot ) { return NULL; }
HL_API hl_runtime_obj *hl_get_obj_proto( hl_type *ot ) { return NULL; }
HL_API void hl_init_enum( hl_type *et, hl_module_context *m ) {}
hl_type hlt_void = hl_type ();
hl_type hlt_i32 = hl_type ();
hl_type hlt_i64 = hl_type ();
hl_type hlt_f64 = hl_type ();
hl_type hlt_f32 = hl_type ();
hl_type hlt_dyn = hl_type ();
hl_type hlt_array = hl_type ();
hl_type hlt_bytes = hl_type ();
hl_type hlt_dynobj = hl_type ();
hl_type hlt_bool = hl_type ();
hl_type hlt_abstract = hl_type ();
HL_API double hl_nan( void ) { return 0; }
HL_API bool hl_is_dynamic( hl_type *t ) { return false; }
HL_API bool hl_same_type( hl_type *a, hl_type *b ) { return false; }
HL_API bool hl_safe_cast( hl_type *t, hl_type *to ) { return false; }
HL_API varray *hl_alloc_array( hl_type *t, int size ) { return 0; }
HL_API varray *hl_alloc_array( hl_type *t, int size ) { return NULL; }
HL_API vdynamic *hl_alloc_dynamic( hl_type *t ) { return NULL; }
HL_API vdynamic *hl_alloc_dynbool( bool b ) { return NULL; }
HL_API vdynamic *hl_alloc_obj( hl_type *t ) { return NULL; }
HL_API venum *hl_alloc_enum( hl_type *t, int index ) { return NULL; }
HL_API vvirtual *hl_alloc_virtual( hl_type *t ) { return NULL; }
HL_API vdynobj *hl_alloc_dynobj( void ) { return 0; }
HL_API vbyte *hl_alloc_bytes( int size ) { return NULL; }
HL_API vbyte *hl_copy_bytes( const vbyte *byte, int size ) { return NULL; }
HL_API int hl_utf8_length( const vbyte *s, int pos ) { return 0; }
HL_API int hl_from_utf8( uchar *out, int outLen, const char *str ) { return 0; }
HL_API char *hl_to_utf8( const uchar *bytes ) { return 0; }
HL_API uchar *hl_to_utf16( const char *str ) { return NULL; }
HL_API vdynamic *hl_virtual_make_value( vvirtual *v ) { return NULL; }
HL_API hl_obj_field *hl_obj_field_fetch( hl_type *t, int fid ) { return NULL; }
HL_API int hl_hash_utf8 ( const char *str ) { return 0; }
HL_API int hl_hash( vbyte *name ) { return 0; }
HL_API int hl_hash_utf8 ( const char *str ) { return 0; } // no cache
HL_API int hl_hash_gen( const uchar *name, bool cache_name ) { return 0; }
HL_API const uchar *hl_field_name( int hash ) { return NULL; }
HL_API vdynamic *hl_dyn_call( vclosure *c, vdynamic **args, int nargs ) { return 0; }
HL_API void hl_error_msg( const uchar *msg, ... ) {}
HL_API void hl_assert( void ) {}
HL_API void hl_throw( vdynamic *v ) {}
HL_API void hl_rethrow( vdynamic *v ) {}
HL_API void hl_setup_longjump( void *j ) {}
HL_API void hl_setup_exception( void *resolve_symbol, void *capture_stack ) {}
HL_API void hl_dump_stack( void ) {}
HL_API varray *hl_exception_stack( void ) { return NULL; }
HL_API bool hl_detect_debugger( void ) { return false; }
HL_API vvirtual *hl_to_virtual( hl_type *vt, vdynamic *obj ) { return NULL; }
HL_API void hl_init_virtual( hl_type *vt, hl_module_context *ctx ) {}
HL_API hl_field_lookup *hl_lookup_find( hl_field_lookup *l, int size, int hash ) { return NULL; }
HL_API hl_field_lookup *hl_lookup_insert( hl_field_lookup *l, int size, int hash, hl_type *t, int index ) { return NULL; }
HL_API int hl_dyn_geti( vdynamic *d, int hfield, hl_type *t ) { return 0; }
HL_API void *hl_dyn_getp( vdynamic *d, int hfield, hl_type *t ) { return NULL; }
HL_API float hl_dyn_getf( vdynamic *d, int hfield ) { return 0; }
HL_API double hl_dyn_getd( vdynamic *d, int hfield ) { return 0; }
HL_API int hl_dyn_casti( void *data, hl_type *t, hl_type *to ) { return 0; }
HL_API void *hl_dyn_castp( void *data, hl_type *t, hl_type *to ) { return NULL; }
HL_API float hl_dyn_castf( void *data, hl_type *t ) { return 0; }
HL_API double hl_dyn_castd( void *data, hl_type *t ) { return 0; }
HL_API int hl_dyn_compare( vdynamic *a, vdynamic *b ) { return 0; }
HL_API vdynamic *hl_make_dyn( void *data, hl_type *t ) { return NULL; }
HL_API void hl_write_dyn( void *data, hl_type *t, vdynamic *v ) {}
HL_API void hl_dyn_seti( vdynamic *d, int hfield, hl_type *t, int value ) {}
HL_API void hl_dyn_setp( vdynamic *d, int hfield, hl_type *t, void *ptr ) {}
HL_API void hl_dyn_setf( vdynamic *d, int hfield, float f ) {}
HL_API void hl_dyn_setd( vdynamic *d, int hfield, double v ) {}
HL_API vdynamic *hl_dyn_op( int op, vdynamic *a, vdynamic *b ) { return NULL; }
HL_API vclosure *hl_alloc_closure_void( hl_type *t, void *fvalue ) { return NULL; }
HL_API vclosure *hl_alloc_closure_ptr( hl_type *fullt, void *fvalue, void *ptr ) { return NULL; }
HL_API vclosure *hl_make_fun_wrapper( vclosure *c, hl_type *to ) { return NULL; }
HL_API void *hl_wrapper_call( void *value, void **args, vdynamic *ret ) { return NULL; }
HL_API void *hl_dyn_call_obj( vdynamic *obj, hl_type *ft, int hfield, void **args, vdynamic *ret ) { return NULL; }
HL_API vdynamic *hl_dyn_call( vclosure *c, vdynamic **args, int nargs ) { return 0; }
HL_API vdynamic *hl_dyn_call_safe( vclosure *c, vdynamic **args, int nargs, bool *isException ) { return NULL; }
HL_API hl_thread *hl_thread_start( void *callback, void *param, bool withGC ) { return NULL; }
HL_API hl_thread *hl_thread_current( void ) { return NULL; }
HL_API void hl_thread_yield(void) {}
HL_API void hl_register_thread( void *stack_top ) {}
HL_API void hl_unregister_thread( void ) {}
HL_API hl_mutex *hl_mutex_alloc( bool gc_thread ) { return NULL; }
HL_API void hl_mutex_acquire( hl_mutex *l ) {}
HL_API bool hl_mutex_try_acquire( hl_mutex *l ) { return false; }
HL_API void hl_mutex_release( hl_mutex *l ) {}
HL_API void hl_mutex_free( hl_mutex *l ) {}
HL_API hl_tls *hl_tls_alloc( bool gc_value ) { return NULL; }
HL_API void hl_tls_set( hl_tls *l, void *value ) {}
HL_API void *hl_tls_get( hl_tls *l );
HL_API void hl_tls_free( hl_tls *l ) {}
HL_API void *hl_gc_alloc_gen( hl_type *t, int size, int flags ) { return 0; }
HL_API void hl_add_root( void *ptr ) {}
HL_API void hl_remove_root( void *ptr ) {}
HL_API void hl_gc_major( void ) {}
HL_API bool hl_is_gc_ptr( void *ptr ) { return false; }
HL_API void hl_blocking( bool b ) {}
HL_API bool hl_is_blocking( void ) { return false; }
HL_API void hl_gc_set_dump_types( hl_types_dump tdump ) {}
HL_API void hl_alloc_init( hl_alloc *a ) {}
HL_API void *hl_malloc( hl_alloc *a, int size ) { return NULL; }
HL_API void *hl_zalloc( hl_alloc *a, int size ) { return NULL; }
HL_API void hl_free( hl_alloc *a ) {}
HL_API void hl_global_init( void ) {}
HL_API void hl_global_free( void ) {}
HL_API void *hl_alloc_executable_memory( int size ) { return NULL; }
HL_API void hl_free_executable_memory( void *ptr, int size ) {}
HL_API hl_buffer *hl_alloc_buffer( void ) { return NULL; }
HL_API void hl_buffer_val( hl_buffer *b, vdynamic *v ) {}
HL_API void hl_buffer_char( hl_buffer *b, uchar c ) {}
HL_API void hl_buffer_str( hl_buffer *b, const uchar *str ) {}
HL_API void hl_buffer_cstr( hl_buffer *b, const char *str ) {}
HL_API void hl_buffer_str_sub( hl_buffer *b, const uchar *str, int len ) {}
HL_API int hl_buffer_length( hl_buffer *b ) { return 0; }
HL_API uchar *hl_buffer_content( hl_buffer *b, int *len ) { return NULL; }
HL_API uchar *hl_to_string( vdynamic *v ) { return NULL; }
HL_API const uchar *hl_type_str( hl_type *t ) { return NULL; }
HL_API void *hl_fatal_error( const char *msg, const char *file, int line ) { return NULL; }
HL_API void hl_fatal_fmt( const char *file, int line, const char *fmt, ...) {}
HL_API void hl_sys_init(void **args, int nargs, void *hlfile) {}
HL_API void hl_setup_callbacks(void *sc, void *gw) {}
HL_API hl_thread_info *hl_get_thread() { return NULL; }
#endif