@@ -3996,6 +3996,57 @@ def test_dylink_i64_b(self):
39963996 }
39973997 ''' , 'other says -1311768467750121224.\n my fp says: 43.\n my second fp says: 43.' )
39983998
3999+ @needs_dlfcn
4000+ def test_dylink_i64_c (self ):
4001+ self .dylink_test (r'''
4002+ #include <cstdio>
4003+ #include <cinttypes>
4004+ #include "header.h"
4005+
4006+ typedef int32_t (*fp_type_32)(int32_t, int32_t, int32_t);
4007+ typedef int64_t (*fp_type_64)(int32_t, int32_t, int32_t);
4008+
4009+ int32_t internal_function_ret_32(int32_t i, int32_t j, int32_t k) {
4010+ return 32;
4011+ }
4012+ int64_t internal_function_ret_64(int32_t i, int32_t j, int32_t k) {
4013+ return 64;
4014+ }
4015+
4016+ int main() {
4017+ fp_type_32 fp32_internal = &internal_function_ret_32;
4018+ fp_type_32 fp32_external = &function_ret_32;
4019+ fp_type_64 fp64_external = &function_ret_64;
4020+ fp_type_64 fp64_internal = &internal_function_ret_64;
4021+ int32_t ires32 = fp32_internal(0,0,0);
4022+ printf("res32 - internal %d\n",ires32);
4023+ int32_t eres32 = fp32_external(0,0,0);
4024+ printf("res32 - external %d\n",eres32);
4025+
4026+ int64_t ires64 = fp64_internal(0,0,0);
4027+ printf("res64 - internal %" PRId64 "\n",ires64);
4028+ int64_t eres64 = fp64_external(0,0,0);
4029+ printf("res64 - external %" PRId64 "\n",eres64);
4030+ return 0;
4031+ }
4032+ ''' , '''
4033+ #include "header.h"
4034+ int32_t function_ret_32(int32_t i, int32_t j, int32_t k) {
4035+ return 32;
4036+ }
4037+ int64_t function_ret_64(int32_t i, int32_t j, int32_t k) {
4038+ return 64;
4039+ }
4040+ ''' , '''res32 - internal 32
4041+ res32 - external 32
4042+ res64 - internal 64
4043+ res64 - external 64\n ''' , header = '''
4044+ #include <emscripten.h>
4045+ #include <cstdint>
4046+ EMSCRIPTEN_KEEPALIVE int32_t function_ret_32(int32_t i, int32_t j, int32_t k);
4047+ EMSCRIPTEN_KEEPALIVE int64_t function_ret_64(int32_t i, int32_t j, int32_t k);
4048+ ''' )
4049+
39994050 @needs_dlfcn
40004051 def test_dylink_class (self ):
40014052 self .dylink_test (header = r'''
0 commit comments