ExternalLibraryFunction.st
author Claus Gittinger <cg@exept.de>
Tue, 23 Aug 2016 19:43:02 +0200
changeset 20299 7db2dc640f2f
parent 20297 85746bbcaf03
child 20307 678da26adf03
child 20343 0719a15ae26d
permissions -rw-r--r--
#FEATURE by cg class: ExternalLibraryFunction added: #dllMappingAt:put:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     1
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG
9464
157fe6ca53e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9463
diff changeset
     3
	      All Rights Reserved
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     4
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     5
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     6
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
     9
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
    10
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
    11
"
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
    14
"{ NameSpace: Smalltalk }"
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
    15
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
ExternalFunction subclass:#ExternalLibraryFunction
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
    17
	instanceVariableNames:'flags moduleName returnType argumentTypes owningClass'
20299
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
    18
	classVariableNames:'CALLTYPE_API CALLTYPE_C CALLTYPE_MASK CALLTYPE_OLE
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
    19
		CALLTYPE_UNIX64 CALLTYPE_V8 CALLTYPE_V9 DLLPATH DllMapping
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
    20
		FLAG_ASYNC FLAG_NONVIRTUAL FLAG_OBJECTIVEC FLAG_RETVAL_IS_CONST
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
    21
		FLAG_UNLIMITEDSTACK FLAG_VIRTUAL LastModuleHandleHolder
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
    22
		LastModuleHandleName Verbose'
9464
157fe6ca53e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9463
diff changeset
    23
	poolDictionaries:''
157fe6ca53e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9463
diff changeset
    24
	category:'System-Support'
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
    27
!ExternalLibraryFunction primitiveDefinitions!
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
    28
%{
20297
85746bbcaf03 compiler warning eliminated
Claus Gittinger <cg@exept.de>
parents: 20295
diff changeset
    29
#include "stxOSDefs.h"
85746bbcaf03 compiler warning eliminated
Claus Gittinger <cg@exept.de>
parents: 20295
diff changeset
    30
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    31
#define VERBOSE
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
    32
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    33
#ifdef VERBOSE
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    34
#  define DEBUGCODE_IF(flag, code) if ((flag) == true) {  code }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    35
# else
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    36
#  define DEBUG_IF(flag, code) /* nothing */
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    37
# endif
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
    38
9337
ab6bbf58bf0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9336
diff changeset
    39
#ifdef HAVE_FFI
20288
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
    40
9337
ab6bbf58bf0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9336
diff changeset
    41
# include <ffi.h>
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
    42
# define MAX_ARGS    128
9365
9003f8432516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9347
diff changeset
    43
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    44
# ifdef USE_STANDARD_FFI
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    45
#  define __get_ffi_type_sint() &ffi_type_sint
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    46
#  define __get_ffi_type_sint8() &ffi_type_sint8
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    47
#  define __get_ffi_type_sint16() &ffi_type_sint16
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    48
#  define __get_ffi_type_sint32() &ffi_type_sint32
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    49
#  define __get_ffi_type_sint64() &ffi_type_sint64
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    50
#  define __get_ffi_type_uint() &ffi_type_uint
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    51
#  define __get_ffi_type_uint8() &ffi_type_uint8
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    52
#  define __get_ffi_type_uint16() &ffi_type_uint16
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    53
#  define __get_ffi_type_uint32() &ffi_type_uint32
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    54
#  define __get_ffi_type_uint64() &ffi_type_uint64
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    55
#  define __get_ffi_type_float() &ffi_type_float
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    56
#  define __get_ffi_type_double() &ffi_type_double
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    57
#  define __get_ffi_type_void() &ffi_type_void
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    58
#  define __get_ffi_type_pointer() &ffi_type_pointer
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    59
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    60
# else
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    61
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    62
   extern ffi_type *__get_ffi_type_sint();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    63
   extern ffi_type *__get_ffi_type_sint8();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    64
   extern ffi_type *__get_ffi_type_sint16();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    65
   extern ffi_type *__get_ffi_type_sint32();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    66
   extern ffi_type *__get_ffi_type_sint64();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    67
   extern ffi_type *__get_ffi_type_uint();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    68
   extern ffi_type *__get_ffi_type_uint8();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    69
   extern ffi_type *__get_ffi_type_uint16();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    70
   extern ffi_type *__get_ffi_type_uint32();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    71
   extern ffi_type *__get_ffi_type_uint64();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    72
   extern ffi_type *__get_ffi_type_float();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    73
   extern ffi_type *__get_ffi_type_double();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    74
   extern ffi_type *__get_ffi_type_void();
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
    75
   extern ffi_type *__get_ffi_type_pointer();
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
    76
   extern INTFUNC __get_ffi_prep_cif();
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
    77
   extern INTFUNC __get_ffi_call();
19536
599f54c61bd8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19535
diff changeset
    78
#  ifdef _MINGW__
599f54c61bd8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19535
diff changeset
    79
#   define ffi_prep_cif (*(__get_ffi_prep_cif()))
599f54c61bd8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19535
diff changeset
    80
#   define ffi_call (*(__get_ffi_call()))
599f54c61bd8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19535
diff changeset
    81
#  endif
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
    82
# endif
9365
9003f8432516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9347
diff changeset
    83
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    84
# define TYPE_UINT      __get_ffi_type_uint()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    85
# define TYPE_UINT8     __get_ffi_type_uint8()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    86
# define TYPE_UINT16    __get_ffi_type_uint16()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    87
# define TYPE_UINT32    __get_ffi_type_uint32()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    88
# define TYPE_UINT64    __get_ffi_type_uint64()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    89
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    90
# define TYPE_SINT      __get_ffi_type_sint()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    91
# define TYPE_SINT8     __get_ffi_type_sint8()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    92
# define TYPE_SINT16    __get_ffi_type_sint16()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    93
# define TYPE_SINT32    __get_ffi_type_sint32()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    94
# define TYPE_SINT64    __get_ffi_type_sint64()
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    95
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
    96
# define TYPE_POINTER   __get_ffi_type_pointer()
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
    97
# define TYPE_FLOAT     __get_ffi_type_float()
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
    98
# define TYPE_DOUBLE    __get_ffi_type_double()
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
    99
# define TYPE_VOID      __get_ffi_type_void()
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   100
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   101
#else /* NO FFI */
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   102
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   103
# define MAX_ARGS    15
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   104
# define TYPE_UINT      1
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   105
# define TYPE_UINT8     2
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   106
# define TYPE_UINT16    3
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   107
# define TYPE_UINT32    4
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   108
# define TYPE_UINT64    5
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   109
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   110
# define TYPE_SINT      11
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   111
# define TYPE_SINT8     12
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   112
# define TYPE_SINT16    13
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   113
# define TYPE_SINT32    14
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   114
# define TYPE_SINT64    15
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   115
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   116
# define TYPE_POINTER   20
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   117
# define TYPE_FLOAT     30
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   118
# define TYPE_DOUBLE    31
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   119
# define TYPE_VOID      40
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   120
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   121
# define FFI_DEFAULT_ABI        0
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   122
# define CALLTYPE_FFI_STDCALL   0
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
   123
9337
ab6bbf58bf0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9336
diff changeset
   124
#endif
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   125
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   126
%}
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   127
! !
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   128
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   129
!ExternalLibraryFunction class methodsFor:'documentation'!
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   130
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   131
copyright
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   132
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   133
 COPYRIGHT (c) 2004 by eXept Software AG
9464
157fe6ca53e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9463
diff changeset
   134
	      All Rights Reserved
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   135
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   136
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   137
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   138
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   139
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   140
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   141
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   142
"
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   143
!
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   144
9331
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   145
documentation
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   146
"
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   147
    instances of me are used to interface to external library functions (as found in a dll/shared object).
19933
d45636ff51df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19932
diff changeset
   148
    Foreign function calls are based on the FFI library if available.
d45636ff51df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19932
diff changeset
   149
    A limited fallback implementation is provided for systems with no libffi.
d45636ff51df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19932
diff changeset
   150
    (this may have limitations on the supported argument types; for example,
d45636ff51df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19932
diff changeset
   151
     the x86_64 fallback does not support float/double arguments).
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   152
    Therefore the fallback should be considered a temporary workaround,
19933
d45636ff51df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19932
diff changeset
   153
    until libffi has been ported.
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   154
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   155
    Inside a method, when a special external-call pragma such as:
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   156
	<api: bool MessageBeep(uint)>
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   157
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   158
    is encountered by the parser, the compiler generates a call via
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   159
	<correspondingExternalLibraryFunctionObject> invokeWithArguments: argumentArray.
19549
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   160
    and the correspondingExternalLibraryFunctionObject is kept in the literal array.
9331
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   161
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   162
    In the invoke method, the library is checked to be loaded (and loaded if not already),
9336
f604a89f17f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9331
diff changeset
   163
    the arguments are converted to C and pushed onto the C-stack, the function is called,
9331
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   164
    and finally, the return value is converted back from C to a smalltalk object.
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   165
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   166
    The parser supports the call-syntax of various other smalltalk dialects:
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   167
	Squeak / ST-X:
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   168
	    <cdecl:   [async] [virtual|nonVirtual][const] returnType functionNameStringOrIndex ( argType1..argTypeN ) module: moduleName >
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   169
	    <apicall: [async] [virtual|nonVirtual][const] returnType functionNameStringOrIndex ( argType1..argTypeN ) module: moduleName >
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   170
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   171
	Dolphin:
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   172
	    <stdcall: [virtual|nonVirtual][const] returnType functionNameStringOrIndex argType1..argTypeN>
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   173
	    <cdecl:   [virtual|nonVirtual][const] returnType functionNameStringOrIndex argType1..argTypeN>
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   174
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   175
	ST/V:
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   176
	    <api: functionName argType1 .. argTypeN returnType>
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   177
	    <ccall: functionName argType1 .. argTypeN returnType>
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   178
	    <ole: vFunctionIndex argType1 .. argTypeN returnType>
12680
b0661f4ef910 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12657
diff changeset
   179
19950
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   180
	VisualWorks:
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   181
	    <c: ...>
Claus Gittinger <cg@exept.de>
parents: 19933
diff changeset
   182
	    <c: #define NAME value>
9331
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   183
"
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   184
!
c26a7de1468c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9330
diff changeset
   185
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   186
example
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   187
"
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   188
								[exBegin]
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   189
	|f|
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   190
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   191
	f := ExternalLibraryFunction new.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   192
	f beCallTypeWINAPI.
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   193
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   194
	f name:'MessageBeep'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   195
	  module:'user32.dll'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   196
	  returnType:#boolean
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   197
	  argumentTypes:#(uint).
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   198
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   199
	f invokeWith:1.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   200
								[exEnd]
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   201
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   202
  Synchronous vs. Asynchronous calls:
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   203
14516
359e4d2234af class: ExternalLibraryFunction
Stefan Vogel <sv@exept.de>
parents: 14506
diff changeset
   204
    by default, foreign function calls are synchronous, effectively blocking the whole ST/X system
19514
7605a907a2eb #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19505
diff changeset
   205
    (that is by purpose,´because most C-code is not prepared for being interrupted, and also, normal
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   206
     code is not prepared for a garbage collector to move objects around, while another C thread might
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   207
     access the data...).
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   208
    Therefore, the following will block all ST/X activity for 10 seconds
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   209
    (try interacting with the launcher while the Sleep is performing):
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   210
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   211
								[exBegin]
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   212
	|f|
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   213
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   214
	f := ExternalLibraryFunction new.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   215
	f beCallTypeWINAPI.
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   216
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   217
	f name:'Sleep'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   218
	  module:'kernel32.dll'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   219
	  returnType:#void
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   220
	  argumentTypes:#(uint).
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   221
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   222
	f invokeWith:10000.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   223
								[exEnd]
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   224
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   225
    if you know what you do and you do not pass any possibly moving objects (such as strings) as argument,
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   226
    the call can be made asynchronous. In that case, ONLY the calling thread will be blocked; all other smalltalk
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   227
    threads wil continue to execute.
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   228
    (try interacting now with the launcher while the Sleep is performing):
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   229
								[exBegin]
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   230
	|f|
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   231
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   232
	f := ExternalLibraryFunction new.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   233
	f beCallTypeWINAPI.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   234
	f beAsync.
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   235
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   236
	f name:'Sleep'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   237
	  module:'kernel32.dll'
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   238
	  returnType:#void
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   239
	  argumentTypes:#(uint).
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   240
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   241
	f invokeWith:10000.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   242
								[exEnd]
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
   243
9322
41c391bfbf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9321
diff changeset
   244
"
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8550
diff changeset
   245
! !
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
8550
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   247
!ExternalLibraryFunction class methodsFor:'instance creation'!
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   248
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   249
name:functionName module:moduleName returnType:returnType argumentTypes:argTypes
8550
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   250
    ^ self new
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   251
	name:functionName module:moduleName
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   252
	returnType:returnType argumentTypes:argTypes
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   253
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   254
    "Created: / 01-08-2006 / 15:19:08 / cg"
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   255
! !
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   256
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   257
!ExternalLibraryFunction class methodsFor:'class initialization'!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   258
11050
226b25e4bb97 comments
Claus Gittinger <cg@exept.de>
parents: 11013
diff changeset
   259
addToDllPath:aDirectoryPathName
226b25e4bb97 comments
Claus Gittinger <cg@exept.de>
parents: 11013
diff changeset
   260
    "can be used during initialization, to add more places for dll-loading"
226b25e4bb97 comments
Claus Gittinger <cg@exept.de>
parents: 11013
diff changeset
   261
19487
79d76a2de0f1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19483
diff changeset
   262
    |oldPath newPath|
11053
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   263
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   264
    oldPath := self dllPath.
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   265
    (oldPath includes:aDirectoryPathName) ifFalse:[
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
   266
	newPath := oldPath asOrderedCollection.
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
   267
	newPath add:aDirectoryPathName.
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
   268
	self dllPath:newPath
11053
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   269
    ]
20289
5472006d6a61 #DOCUMENTATION by sr
sr
parents: 20288
diff changeset
   270
5472006d6a61 #DOCUMENTATION by sr
sr
parents: 20288
diff changeset
   271
    "
5472006d6a61 #DOCUMENTATION by sr
sr
parents: 20288
diff changeset
   272
     self addToDllPath:'c:\matrix\API\dll'
5472006d6a61 #DOCUMENTATION by sr
sr
parents: 20288
diff changeset
   273
    "
11050
226b25e4bb97 comments
Claus Gittinger <cg@exept.de>
parents: 11013
diff changeset
   274
!
226b25e4bb97 comments
Claus Gittinger <cg@exept.de>
parents: 11013
diff changeset
   275
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   276
dllMapping
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   277
    "allows for dll's to be replaced,
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   278
     for example, if you want to use the mozilla sqlite dll
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   279
	C:\Program Files\Mozilla Firefox\mozsqlite3.dll
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   280
     for the sqlite3, execute:
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   281
	ExternalLibraryFunction
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   282
	    dllMapping at:'sqlite3'
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   283
	    put: 'C:\Program Files\Mozilla Firefox\mozsqlite3.dll'
19549
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   284
     for mingw:
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   285
	ExternalLibraryFunction
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   286
	    dllMapping at:'sqlite3'
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   287
	    put:'C:\mingw64\opt\bin\libsqlite3-0.dll'
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   288
    "
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   289
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   290
    DllMapping isNil ifTrue:[
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19549
diff changeset
   291
	DllMapping := Dictionary new.
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   292
    ].
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   293
    ^ DllMapping
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   294
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   295
    "Created: / 10-04-2012 / 12:21:45 / cg"
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   296
!
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   297
20299
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   298
dllMappingAt:baseLibname put:aNameOrPath
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   299
    "allows for dll's to be replaced,
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   300
     for example, if you want to use the mozilla sqlite dll
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   301
        C:\Program Files\Mozilla Firefox\mozsqlite3.dll
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   302
     for the sqlite3, execute:
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   303
        ExternalLibraryFunction
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   304
            dllMappingAt:'sqlite3'
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   305
            put: 'C:\Program Files\Mozilla Firefox\mozsqlite3.dll'
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   306
     for mingw:
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   307
        ExternalLibraryFunction
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   308
            dllMappingAt:'sqlite3'
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   309
            put:'C:\mingw64\opt\bin\libsqlite3-0.dll'
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   310
    "
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   311
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   312
    self dllMapping at:baseLibname put: aNameOrPath
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   313
!
7db2dc640f2f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20297
diff changeset
   314
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   315
dllPath
19549
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   316
    "provide a default dllPath, where external libraries are searched for"
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   317
13337
d1733931bc10 changed:
Stefan Vogel <sv@exept.de>
parents: 13334
diff changeset
   318
    ^ DLLPATH
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   319
!
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   320
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   321
dllPath:aCollectionOfDirectoryPathNames
19549
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   322
    "provide a default dllPath, where external libraries are searched for"
7ebabee7eecd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19536
diff changeset
   323
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   324
    DLLPATH := aCollectionOfDirectoryPathNames
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   325
!
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   326
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   327
initialize
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   328
    "using inline access to corresponding c--defines to avoid duplicate places of knowledge"
13337
d1733931bc10 changed:
Stefan Vogel <sv@exept.de>
parents: 13334
diff changeset
   329
d1733931bc10 changed:
Stefan Vogel <sv@exept.de>
parents: 13334
diff changeset
   330
    DLLPATH isNil ifTrue:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   331
	DLLPATH := #('.').
18228
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   332
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18228
diff changeset
   333
#ifndef __SCHTEAM__
18228
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   334
	@global(FLAG_VIRTUAL) = __MKSMALLINT(__EXTL_FLAG_VIRTUAL);                  // a virtual c++ call
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   335
	@global(FLAG_NONVIRTUAL) = __MKSMALLINT(__EXTL_FLAG_NONVIRTUAL);            // a non-virtual c++ call
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   336
	@global(FLAG_OBJECTIVEC) = __MKSMALLINT(__EXTL_FLAG_OBJECTIVEC);            // an objectiveC message send
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   337
	@global(FLAG_UNLIMITEDSTACK) = __MKSMALLINT(__EXTL_FLAG_UNLIMITEDSTACK);    // unlimitedstack under unix
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   338
	@global(FLAG_ASYNC) = __MKSMALLINT(__EXTL_FLAG_ASYNC);                      // async under win32
20297
85746bbcaf03 compiler warning eliminated
Claus Gittinger <cg@exept.de>
parents: 20295
diff changeset
   339
	@global(FLAG_RETVAL_IS_CONST) = __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST);  // retvalue is not to be registered for finalization
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   340
18228
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   341
	@global(CALLTYPE_API) = __MKSMALLINT(__EXTL_CALLTYPE_API);                  // WINAPI-call (win32 only)
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   342
	@global(CALLTYPE_C) = __MKSMALLINT(__EXTL_CALLTYPE_C);                      // regular C-call (the default)
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   343
	@global(CALLTYPE_V8) = __MKSMALLINT(__EXTL_CALLTYPE_V8);                    // v8 call (sparc only)
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   344
	@global(CALLTYPE_V9) = __MKSMALLINT(__EXTL_CALLTYPE_V9);                    // v9 call (sparc only)
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   345
	@global(CALLTYPE_UNIX64) = __MKSMALLINT(__EXTL_CALLTYPE_UNIX64);            // unix64 call (alpha only)
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   346
18228
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   347
	@global(CALLTYPE_MASK) = __MKSMALLINT(__EXTL_CALLTYPE_MASK);
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   348
#endif
061da222bd70 java support
Claus Gittinger <cg@exept.de>
parents: 15002
diff changeset
   349
%}
13337
d1733931bc10 changed:
Stefan Vogel <sv@exept.de>
parents: 13334
diff changeset
   350
    ].
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   351
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   352
    "
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   353
     self initialize
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   354
    "
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   355
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   356
    "Modified: / 03-10-2006 / 21:27:47 / cg"
11053
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   357
!
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   358
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   359
removeFromDllPath:aDirectoryPathName
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   360
    "remove added places from dll-loading"
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   361
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   362
    |oldPath|
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   363
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   364
    oldPath := self dllPath.
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   365
    self dllPath:(oldPath asOrderedCollection copyWithout:aDirectoryPathName)
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   366
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   367
    "
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   368
     self dllPath.
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   369
     self addToDllPath:'C:\aaa\bbb'.
11053
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   370
     self dllPath.
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   371
     self removeFromDllPath:'C:\aaa\bbb'.
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   372
     self dllPath.
bcf4ebb25868 +removeFromDLLPath
Claus Gittinger <cg@exept.de>
parents: 11050
diff changeset
   373
    "
8550
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   374
! !
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   375
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   376
!ExternalLibraryFunction class methodsFor:'constants'!
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   377
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   378
callTypeAPI
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   379
    ^ CALLTYPE_API
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   380
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   381
    "Modified: / 01-08-2006 / 13:44:41 / cg"
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   382
!
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   383
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   384
callTypeC
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   385
    ^ CALLTYPE_C
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   386
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   387
    "Modified: / 01-08-2006 / 13:44:49 / cg"
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   388
!
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   389
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   390
callTypeCDecl
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   391
    ^ CALLTYPE_C
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   392
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   393
    "Modified: / 01-08-2006 / 13:44:52 / cg"
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   394
!
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   395
10619
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   396
callTypeMASK
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   397
    ^ CALLTYPE_MASK
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   398
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   399
    "Modified: / 01-08-2006 / 13:44:57 / cg"
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   400
!
dc8c965a8602 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10618
diff changeset
   401
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   402
callTypeOLE
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   403
    ^ CALLTYPE_OLE
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
   404
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   405
    "Modified: / 01-08-2006 / 13:44:57 / cg"
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   406
! !
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   407
19505
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   408
!ExternalLibraryFunction class methodsFor:'debugging'!
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   409
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   410
verbose:aBoolean
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   411
    "turn on/off tracing of calls"
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   412
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   413
    Verbose := aBoolean
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   414
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   415
    "
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   416
     ExternalLibraryFunction verbose:true
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   417
    "
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   418
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   419
    "Created: / 30-03-2016 / 17:28:23 / cg"
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   420
! !
3014e8447db8 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19501
diff changeset
   421
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   422
!ExternalLibraryFunction class methodsFor:'type name mapping'!
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   423
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   424
ffiTypeSymbolForType:aType
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   425
    "map type to one of the ffi-supported ones:
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   426
	sint8, sint16, sint32, sint64
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   427
	uint8, uint16, uint32, uint64
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   428
	bool void pointer handle
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   429
    "
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   430
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   431
    aType == #sint8           ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   432
    aType == #sint16          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   433
    aType == #sint32          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   434
    aType == #sint64          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   435
    aType == #uint8           ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   436
    aType == #uint16          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   437
    aType == #uint32          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   438
    aType == #uint64          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   439
    aType == #double          ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   440
    aType == #float           ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   441
    aType == #char            ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   442
    aType == #void            ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   443
    aType == #bool            ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   444
    aType == #pointer         ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   445
    aType == #charPointer     ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   446
    aType == #wcharPointer    ifTrue:[^ aType ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   447
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   448
    aType == #int8            ifTrue:[^ #sint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   449
    aType == #int16           ifTrue:[^ #sint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   450
    aType == #int32           ifTrue:[^ #sint32 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   451
    aType == #int64           ifTrue:[^ #sint64 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   452
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   453
    aType == #voidPointer         ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   454
    aType == #uint8Pointer        ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   455
    aType == #voidPointerPointer  ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   456
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   457
    aType == #short           ifTrue:[^ #sint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   458
    aType == #long            ifTrue:[^ #long ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   459
    aType == #int             ifTrue:[^ #int ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   460
    aType == #uint            ifTrue:[^ #uint ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   461
    aType == #ushort          ifTrue:[^ #uint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   462
    aType == #unsignedShort   ifTrue:[^ #uint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   463
    aType == #ulong           ifTrue:[^ #ulong ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   464
    aType == #unsignedLong    ifTrue:[^ #ulong ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   465
    aType == #uchar           ifTrue:[^ #uint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   466
    aType == #unsignedChar    ifTrue:[^ #uint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   467
    aType == #byte            ifTrue:[^ #uint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   468
    aType == #longlong        ifTrue:[^ #sint64 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   469
    aType == #longLong        ifTrue:[^ #sint64 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   470
    aType == #ulonglong       ifTrue:[^ #uint64 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   471
    aType == #ulongLong       ifTrue:[^ #uint64 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   472
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   473
    "/ windefs
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   474
    aType == #dword           ifTrue:[^ #uint32 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   475
    aType == #sdword          ifTrue:[^ #sint32 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   476
    aType == #word            ifTrue:[^ #uint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   477
    aType == #sword           ifTrue:[^ #sint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   478
    aType == #handle          ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   479
    aType == #lpstr           ifTrue:[^ #charPointer ].
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
   480
    "/ aType == #hresult         ifTrue:[^ #uint32 ].  -- keep this; it is translated later (in invoke)
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   481
    aType == #boolean         ifTrue:[^ #bool ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   482
    "/ care for 64bit machines
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   483
    aType == #ulongReturn     ifTrue:[^ ExternalAddress pointerSize == 8 ifTrue:[#uint64] ifFalse:[#uint32]].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   484
    aType == #none            ifTrue:[^ #void ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   485
    aType == #struct          ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   486
    aType == #structIn        ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   487
    aType == #structOut       ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   488
    aType == #structInOut     ifTrue:[^ #pointer ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   489
    aType == #unsigned        ifTrue:[^ #uint ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   491
    aType == #ATOM            ifTrue:[^ #uint16 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   492
    aType == #BOOL            ifTrue:[^ #int ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   493
    aType == #BOOLEAN         ifTrue:[^ #uint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   494
    aType == #BYTE            ifTrue:[^ #uint8 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   495
    aType == #DWORD           ifTrue:[^ #uint32 ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   496
    aType == #HANDLE          ifTrue:[^ #pointer ].
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   497
    aType == #HRESULT         ifTrue:[^ #hresult ].
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
   498
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   499
    "/ care for 64bit machines
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   500
    aType == #SIZE_T          ifTrue:[^ ExternalAddress pointerSize == 8 ifTrue:[#uint64] ifFalse:[#uint32]].
19494
38815600ddbe #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19490
diff changeset
   501
    aType == #BSTR            ifTrue:[^ #wcharPointer].
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   502
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   503
    (aType isString or:[aType isSymbol]) ifFalse:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   504
	CType isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   505
	    self error:'unknown type'.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   506
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   507
	^ aType typeSymbol.
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   508
    ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   509
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   510
    (aType endsWith:'*') ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   511
	^ #pointer.
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   512
    ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   513
    (aType endsWith:'Pointer') ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   514
	^ #pointer.
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   515
    ].
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   516
    ^ aType
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   517
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
   518
    "Modified (format): / 30-03-2016 / 13:45:09 / cg"
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   519
! !
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   520
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   521
!ExternalLibraryFunction methodsFor:'accessing'!
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   522
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   523
argumentTypes
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   524
    ^ argumentTypes
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   525
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   526
11426
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   527
argumentTypesString
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   528
    ^ String
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   529
	streamContents:[:s |
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   530
	    argumentTypes do:[:eachArgType |
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   531
		eachArgType printOn:s.
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   532
	    ] separatedBy:[
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   533
		s nextPutAll:','.
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   534
	    ].
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   535
	].
11426
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   536
!
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   537
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   538
beAsync
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   539
    "let this execute in a separate thread, in par with the other execution thread(s).
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   540
     Ignored under unix/linux (until those support multiple threads too)."
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   541
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   542
    flags := (flags ? 0) bitOr: FLAG_ASYNC.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   543
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   544
    "Created: / 01-08-2006 / 13:42:38 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   545
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   546
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   547
beCallTypeAPI
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   548
    flags := (flags ? 0) bitOr: CALLTYPE_API.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   549
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   550
    "Created: / 01-08-2006 / 15:12:40 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   551
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   552
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   553
beCallTypeC
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   554
    flags := (flags ? 0) bitOr: CALLTYPE_C.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   555
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   556
    "Created: / 01-08-2006 / 15:12:40 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   557
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   558
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   559
beCallTypeOLE
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   560
    flags := (flags ? 0) bitOr: FLAG_VIRTUAL.
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   561
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   562
    "Created: / 01-08-2006 / 15:12:40 / cg"
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   563
!
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   564
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   565
beCallTypeUNIX64
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   566
    flags := (flags ? 0) bitOr: CALLTYPE_UNIX64.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   567
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   568
    "Created: / 01-08-2006 / 15:13:38 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   569
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   570
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   571
beCallTypeV8
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   572
    flags := (flags ? 0) bitOr: CALLTYPE_V8.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   573
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   574
    "Created: / 01-08-2006 / 15:13:28 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   575
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   576
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   577
beCallTypeV9
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   578
    flags := (flags ? 0) bitOr: CALLTYPE_V9.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   579
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   580
    "Created: / 01-08-2006 / 15:13:31 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   581
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   582
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   583
beCallTypeWINAPI
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   584
    self beCallTypeAPI
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   585
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   586
    "Modified: / 01-08-2006 / 15:14:02 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   587
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   588
9525
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   589
beConstReturnValue
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   590
    "specify that a pointer return value is not to be finalized
9525
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   591
     (i.e. points to static data or data which is freed by c)"
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   592
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   593
    flags := (flags ? 0) bitOr: FLAG_RETVAL_IS_CONST.
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   594
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   595
    "Created: / 01-08-2006 / 13:56:48 / cg"
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   596
!
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   597
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   598
beNonVirtualCPP
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   599
    "specify this as a non-virtual c++-function"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   600
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   601
    flags := (flags ? 0) bitOr: FLAG_NONVIRTUAL.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   602
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   603
    "Created: / 01-08-2006 / 13:56:44 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   604
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   605
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   606
beObjectiveC
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   607
    "specify this as an objective-c message send"
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   608
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   609
    flags := (flags ? 0) bitOr: FLAG_OBJECTIVEC.
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   610
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   611
    "Created: / 01-08-2006 / 13:56:48 / cg"
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   612
!
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   613
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   614
beUnlimitedStack
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   615
    "let this execute on the c-stack (as opposed to the thread-stack)
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   616
     for unlimited auto-sized-stack under unix/linux.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   617
     Ignored under windows."
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   618
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   619
    flags := (flags ? 0) bitOr: FLAG_UNLIMITEDSTACK.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   620
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   621
    "Created: / 01-08-2006 / 13:41:54 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   622
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   623
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   624
beVirtualCPP
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   625
    "specify this as a virtual c++-function"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   626
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   627
    flags := (flags ? 0) bitOr: FLAG_VIRTUAL.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   628
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   629
    "Created: / 01-08-2006 / 13:56:48 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   630
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   631
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   632
callTypeNumber
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   633
    ^ (flags ? 0) bitAnd: CALLTYPE_MASK.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   634
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   635
    "Created: / 01-08-2006 / 15:12:10 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   636
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   637
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   638
isAsync
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   639
    "is this executed in a separate thread, in par with the other execution thread(s) ?"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   640
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   641
    ^ (flags ? 0) bitTest: FLAG_ASYNC.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   642
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   643
    "Created: / 01-08-2006 / 13:46:53 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   644
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   645
9519
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   646
isCPPFunction
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   647
    "is this a virtual or non-virtual c++-function ?"
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   648
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   649
    ^ (flags ? 0) bitTest: (FLAG_VIRTUAL bitOr: FLAG_NONVIRTUAL).
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   650
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   651
    "Created: / 01-08-2006 / 13:56:54 / cg"
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   652
!
ad18bf96758d *** empty log message ***
ca
parents: 9483
diff changeset
   653
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   654
isCallTypeAPI
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   655
    "is this a windows API-call linkage call.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   656
     Attention: this uses a different call API (callee unwinds the stack),
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   657
     and MUST be declared as such for many Kernel functions.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   658
     The calltype API is one of the worst historic garbage kept by MS..."
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   659
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   660
    ^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_API.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   661
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   662
    "Created: / 01-08-2006 / 15:21:16 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   663
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   664
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   665
isCallTypeC
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   666
    "is this a regular C-call (attention: on windows, there are two kinds of calls)"
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   667
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   668
    ^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_C.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   669
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   670
    "Created: / 01-08-2006 / 15:21:23 / cg"
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   671
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   672
10483
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   673
isCallTypeOLE
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   674
    "is this an OLE-object call ? (eg. a virtual c++ call; same as isCallTypeCPP)"
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   675
10483
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   676
    ^ ((flags ? 0) bitTest: FLAG_VIRTUAL).
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   677
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   678
    "Created: / 01-08-2006 / 15:21:23 / cg"
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   679
!
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   680
9525
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   681
isConstReturnValue
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   682
    "is the pointer return value not to be finalized
9525
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   683
     (i.e. points to static data or data which is freed by c)"
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   684
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   685
    ^ (flags ? 0) bitTest: FLAG_RETVAL_IS_CONST.
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   686
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   687
    "Created: / 01-08-2006 / 13:56:48 / cg"
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   688
!
120234adc94e const specifier (is this a good name ?)
ca
parents: 9524
diff changeset
   689
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   690
isNonVirtualCPP
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   691
    "is this a non-virtual c++-function ?"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   692
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   693
    ^ (flags ? 0) bitTest: FLAG_NONVIRTUAL.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   694
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   695
    "Created: / 01-08-2006 / 13:56:51 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   696
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   697
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   698
isObjectiveC
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   699
    "is this an objective-C message?"
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   700
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   701
    ^ (flags ? 0) bitTest: FLAG_OBJECTIVEC.
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   702
!
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   703
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   704
isUnlimitedStack
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   705
    "will this execute on the c-stack (as opposed to the thread-stack)
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   706
     for unlimited auto-sized-stack under unix/linux.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   707
     Ignored under windows."
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   708
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   709
    ^ (flags ? 0) bitTest: FLAG_UNLIMITEDSTACK.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   710
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   711
    "Created: / 01-08-2006 / 14:17:07 / cg"
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   712
!
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   713
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   714
isVirtualCPP
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   715
    "is this a virtual c++-function (same as isCallTypeOLE) ?"
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   716
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   717
    ^ (flags ? 0) bitTest: FLAG_VIRTUAL.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   718
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
   719
    "Created: / 01-08-2006 / 13:56:54 / cg"
10483
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   720
!
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   721
11426
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   722
moduleName
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   723
    ^ moduleName
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   724
!
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   725
10484
29039d89239d + returnType
fm
parents: 10483
diff changeset
   726
returnType
29039d89239d + returnType
fm
parents: 10483
diff changeset
   727
    ^ returnType
29039d89239d + returnType
fm
parents: 10483
diff changeset
   728
!
29039d89239d + returnType
fm
parents: 10483
diff changeset
   729
10483
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   730
vtableIndex
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   731
    name isNumber ifFalse:[^ nil].
79c64bcd4d29 +ole queries
fm
parents: 10481
diff changeset
   732
    ^ name.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   733
! !
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   734
20289
5472006d6a61 #DOCUMENTATION by sr
sr
parents: 20288
diff changeset
   735
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   736
!ExternalLibraryFunction methodsFor:'invoking'!
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   737
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   738
invoke
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   739
    self hasCode ifFalse:[
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
   740
	self prepareInvoke.
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   741
    ].
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   742
    ^ self invokeFFIwithArguments:nil forCPPInstance:nil
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   743
!
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   744
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   745
invokeCPPVirtualOn:anInstance
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   746
    self hasCode ifFalse:[
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   747
	self prepareInvoke.
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   748
    ].
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
   749
    ^ self invokeCPPVirtualFFIOn:anInstance withArguments:nil
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   750
!
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   751
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   752
invokeCPPVirtualOn:instance with:arg
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   753
    self hasCode ifFalse:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   754
	self prepareInvoke.
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   755
    ].
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   756
    ^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg)
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   757
!
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   758
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   759
invokeCPPVirtualOn:instance with:arg1 with:arg2
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   760
    self hasCode ifFalse:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   761
	self prepareInvoke.
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   762
    ].
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   763
    ^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2)
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   764
!
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   765
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   766
invokeCPPVirtualOn:instance with:arg1 with:arg2 with:arg3
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   767
    self hasCode ifFalse:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   768
	self prepareInvoke.
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   769
    ].
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   770
    ^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2 with:arg3)
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   771
!
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   772
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   773
invokeCPPVirtualOn:instance with:arg1 with:arg2 with:arg3 with:arg4
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   774
    self hasCode ifFalse:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   775
	self prepareInvoke.
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   776
    ].
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
   777
    ^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4)
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   778
!
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   779
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   780
invokeCPPVirtualOn:instance withArguments:args
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   781
    self hasCode ifFalse:[
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   782
	self prepareInvoke.
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   783
    ].
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   784
    ^ self invokeCPPVirtualFFIOn:instance withArguments:args
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   785
!
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   786
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   787
invokeWith:arg
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   788
    self hasCode ifFalse:[
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
   789
	self prepareInvoke.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   790
    ].
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   791
    ^ self invokeFFIwithArguments:(Array with:arg) forCPPInstance:nil
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   792
!
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   793
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   794
invokeWith:arg1 with:arg2
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   795
    self hasCode ifFalse:[
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
   796
	self prepareInvoke.
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   797
    ].
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   798
    ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2) forCPPInstance:nil
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   799
!
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   800
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   801
invokeWith:arg1 with:arg2 with:arg3
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   802
    self hasCode ifFalse:[
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
   803
	self prepareInvoke.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   804
    ].
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   805
    ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3) forCPPInstance:nil
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   806
!
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   807
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   808
invokeWith:arg1 with:arg2 with:arg3 with:arg4
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   809
    self hasCode ifFalse:[
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
   810
	self prepareInvoke.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   811
    ].
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
   812
    ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) forCPPInstance:nil
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   813
!
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   814
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   815
invokeWithArguments:argArray
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   816
    self hasCode ifFalse:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   817
	self prepareInvoke.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   818
    ].
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   819
    ^ self invokeFFIwithArguments:argArray forCPPInstance:nil
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   820
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   821
    "Modified: / 01-08-2006 / 16:04:08 / cg"
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   822
! !
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   823
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   824
!ExternalLibraryFunction methodsFor:'printing'!
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   825
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   826
printOn:aStream
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   827
    aStream nextPutAll:'<'.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   828
    self isCallTypeAPI ifTrue:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   829
	'API:' printOn:aStream.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   830
    ] ifFalse:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   831
	self isCallTypeOLE ifTrue:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   832
	    'OLE:' printOn:aStream.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   833
	] ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   834
	    self isCallTypeC ifTrue:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   835
		'C:' printOn:aStream.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   836
	    ] ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   837
		self error.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   838
	    ].
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   839
	].
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   840
    ].
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   841
    aStream nextPutAll:' '.
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   842
    name printOn:aStream.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   843
    moduleName notNil ifTrue:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   844
	aStream nextPutAll:' module:'.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
   845
	moduleName printOn:aStream.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   846
    ].
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   847
    aStream nextPutAll:'>'.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   848
14356
d0e1264c11fe changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 14103
diff changeset
   849
    "Modified: / 25-09-2012 / 12:06:14 / cg"
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   850
! !
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   851
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   852
!ExternalLibraryFunction methodsFor:'private'!
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   853
10213
31717eee6fb2 changed #ffiTypeSymbolForType:
fm
parents: 10025
diff changeset
   854
adjustTypes
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   855
    "map all those existing type names to a small number of definite ffi type names.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   856
     This is needed, because there are so many different C-type names found in code imported
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   857
     from various Smalltalk dialects' library function call declarations.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   858
     For example: all of word, WORD, unsignedShort, ushort, uShort etc. will map to uint16.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   859
     Also, this deals with pointer size differences."
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   860
19313
4e56f471a6c3 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19311
diff changeset
   861
    argumentTypes notEmptyOrNil ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   862
	argumentTypes := argumentTypes collect:[:argType | self class ffiTypeSymbolForType:argType].
10213
31717eee6fb2 changed #ffiTypeSymbolForType:
fm
parents: 10025
diff changeset
   863
    ].
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   864
    returnType := self class ffiTypeSymbolForType:returnType.
10213
31717eee6fb2 changed #ffiTypeSymbolForType:
fm
parents: 10025
diff changeset
   865
!
31717eee6fb2 changed #ffiTypeSymbolForType:
fm
parents: 10025
diff changeset
   866
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   867
linkToModule
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   868
    "link this function to the external module.
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   869
     I.e. retrieve the module handle and the code pointer."
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   870
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   871
    |handle moduleNameUsed functionName|
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   872
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   873
    name isNumber ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   874
	self isCPPFunction ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   875
	    "/ no need to load a dll.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   876
	    ^ self
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   877
	]
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   878
    ].
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
   879
13782
1994fe87f21e comment/format in: #linkToModule
Claus Gittinger <cg@exept.de>
parents: 13412
diff changeset
   880
    "/ in some other smalltalks, there is no moduleName in the ffi-spec;
1994fe87f21e comment/format in: #linkToModule
Claus Gittinger <cg@exept.de>
parents: 13412
diff changeset
   881
    "/ instead, the class provides the libraryName...
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   882
    (moduleNameUsed := moduleName) isNil ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   883
	owningClass isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   884
	    self error:'Missing moduleName'.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   885
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   886
	moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol.
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   887
    ].
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   888
    moduleHandle isNil ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   889
	"/ speedup. in 95% of all calls, the same moduleName is resolved here
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   890
	(LastModuleHandleHolder isNil
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   891
	or:[ (handle := LastModuleHandleHolder at:1) isNil
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   892
	or:[ LastModuleHandleName ~= moduleNameUsed ]]) ifTrue:[
19342
3afa63c8dcae #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19341
diff changeset
   893
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   894
	    handle := self loadLibrary:moduleNameUsed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   895
	    handle isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   896
		self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed).
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   897
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   898
	    LastModuleHandleHolder := WeakArray with:handle.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   899
	    LastModuleHandleName := moduleNameUsed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   900
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   901
	moduleHandle := handle.
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   902
    ].
9341
719fcf48695b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9340
diff changeset
   903
    name isNumber ifFalse:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   904
	functionName := name.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   905
	(moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   906
	    (moduleHandle getFunctionAddress:('_', functionName) into:self) isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   907
		moduleHandle := nil.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   908
		self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   909
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   910
	].
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   911
    ].
9392
11914531960a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9386
diff changeset
   912
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   913
    "Modified: / 10-04-2012 / 12:12:44 / cg"
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   914
!
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   915
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   916
loadLibrary:dllName
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   917
    "load a dll.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   918
     Notice the dllMapping mechanism, which can be used to silently load different dlls.
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   919
     This is useful, if some code has a hardcoded dll-name in it, which needs to be changed,
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   920
     but you do not want or cannot recompile the methods (i.e. no source avail)"
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   921
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
   922
    |handle nameString filename|
10279
60c42983fdd4 first test whether the dllName is the complete filename
ca
parents: 10270
diff changeset
   923
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   924
    filename := dllName.
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   925
    DllMapping notNil ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   926
	filename := DllMapping at:filename ifAbsent:[ filename ]
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   927
    ].
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   928
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   929
    filename := filename asFilename.
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
   930
    nameString := filename name.
10279
60c42983fdd4 first test whether the dllName is the complete filename
ca
parents: 10270
diff changeset
   931
12937
7d5f512fb14a changed: #loadLibrary:
Stefan Vogel <sv@exept.de>
parents: 12680
diff changeset
   932
    "try to load, maybe the system knows where to find the dll"
7d5f512fb14a changed: #loadLibrary:
Stefan Vogel <sv@exept.de>
parents: 12680
diff changeset
   933
    handle := ObjectFileLoader loadDynamicObject:filename.
7d5f512fb14a changed: #loadLibrary:
Stefan Vogel <sv@exept.de>
parents: 12680
diff changeset
   934
    handle notNil ifTrue:[^ handle ].
7d5f512fb14a changed: #loadLibrary:
Stefan Vogel <sv@exept.de>
parents: 12680
diff changeset
   935
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
   936
    filename isAbsolute ifFalse:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   937
	"First ask the class defining the ExternalFunction for the location of the dlls ..."
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   938
	owningClass notNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   939
	    owningClass dllPath do:[:eachDirectory |
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   940
		handle := ObjectFileLoader
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   941
			    loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   942
		handle notNil ifTrue:[^ handle ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   943
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   944
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   945
	".. then ask the system"
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   946
	self class dllPath do:[:eachDirectory |
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   947
	    handle := ObjectFileLoader
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   948
			loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   949
	    handle notNil ifTrue:[^ handle ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   950
	].
10279
60c42983fdd4 first test whether the dllName is the complete filename
ca
parents: 10270
diff changeset
   951
    ].
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   952
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
   953
    filename suffix isEmpty ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   954
	"/ try again with the OS-specific dll-extension
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   955
	^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix)
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   956
    ].
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
   957
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   958
    ^ nil
14103
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   959
3df000b77712 class definition
Claus Gittinger <cg@exept.de>
parents: 14037
diff changeset
   960
    "Modified: / 10-04-2012 / 12:21:06 / cg"
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   961
!
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   962
9321
734c7c432461 not yet finished
Claus Gittinger <cg@exept.de>
parents: 8891
diff changeset
   963
prepareInvoke
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   964
    "called before invoked.
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   965
     When called the very first time, moduleHandle is nil,
19490
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   966
     and we ensure that the dll is loaded, the function address is extracted"
4d29d49edd98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19489
diff changeset
   967
10270
897474c6c785 allow setting the dllPath
fm
parents: 10213
diff changeset
   968
    (moduleHandle isNil or:[self hasCode not]) ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   969
	self linkToModule.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
   970
	self adjustTypes.
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   971
    ].
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   972
! !
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   973
8550
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   974
!ExternalLibraryFunction methodsFor:'private-accessing'!
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
   975
9466
73333f358696 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9465
diff changeset
   976
name:functionNameOrVirtualIndex module:aModuleName returnType:aReturnType argumentTypes:argTypes
73333f358696 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9465
diff changeset
   977
    name := functionNameOrVirtualIndex.
73333f358696 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9465
diff changeset
   978
    functionNameOrVirtualIndex isNumber ifTrue:[
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
   979
	self beVirtualCPP.
9466
73333f358696 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9465
diff changeset
   980
    ].
8891
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   981
    moduleName := aModuleName.
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   982
    returnType := aReturnType.
c30a030ff5ec more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents: 8728
diff changeset
   983
    argumentTypes := argTypes.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   984
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   985
    "Created: / 01-08-2006 / 15:19:52 / cg"
9466
73333f358696 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9465
diff changeset
   986
    "Modified: / 02-08-2006 / 17:20:13 / cg"
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   987
!
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   988
11426
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   989
owningClass
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   990
    ^ owningClass
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   991
!
1fccae300393 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11053
diff changeset
   992
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   993
owningClass:aClass
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   994
    owningClass := aClass.
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   995
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
   996
    "Created: / 01-08-2006 / 15:22:50 / cg"
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
   997
!
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
   998
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
   999
setModuleName:aModuleName
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1000
    aModuleName ~= moduleName ifTrue:[
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  1001
	self code:nil.
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  1002
	moduleHandle := nil.
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  1003
	moduleName := aModuleName.
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1004
    ].
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1005
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1006
    "Created: / 07-06-2007 / 10:20:17 / cg"
8550
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
  1007
! !
72982f85bd41 *** empty log message ***
ca
parents: 8533
diff changeset
  1008
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1009
!ExternalLibraryFunction methodsFor:'private-invoking'!
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1010
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
  1011
invokeCPPVirtualFFIOn:instance withArguments:arguments
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1012
    ^ self invokeFFIwithArguments:arguments forCPPInstance:instance
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1013
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1014
    "Modified: / 01-08-2006 / 13:55:30 / cg"
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1015
!
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1016
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
  1017
invokeFFIWithArguments:arguments
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1018
    ^ self invokeFFIwithArguments:arguments forCPPInstance:nil
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1019
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1020
    "Modified: / 01-08-2006 / 13:55:35 / cg"
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
  1021
!
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
  1022
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1023
invokeFFIwithArguments:argumentsOrNil forCPPInstance:aReceiverOrNil
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1024
    "basic invoke mechanism. Calls the function represented by the receiver with argumentsOrNil.
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1025
     For cplusplus, aReceiverOrNil is required to be an externalStructure like object;
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1026
     for objectiveC, it must be an ObjectiveC object"
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1027
19341
2ab29dd7ec1a mingw 64bit fixes (xxLL in constants - sigh)
Claus Gittinger <cg@exept.de>
parents: 19334
diff changeset
  1028
    |argTypeSymbols returnTypeSymbol failureCode failureArgNr failureInfo returnValue stClass vtOffset
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1029
     virtual objectiveC async unlimitedStack callTypeNumber returnValueClass argValueClass
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1030
     oldReturnType oldArgumentTypes|
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1031
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  1032
    argTypeSymbols := argumentTypes.
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  1033
    returnTypeSymbol := returnType.
9346
a95e2cf0e56f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9344
diff changeset
  1034
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  1035
    virtual := self isVirtualCPP.
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1036
    objectiveC := self isObjectiveC.
9524
2af286bbcac3 *** empty log message ***
ca
parents: 9519
diff changeset
  1037
    (virtual "or:[self isNonVirtualCPP]") ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1038
	aReceiverOrNil isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1039
	    "/ must have a c++ object instance
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1040
	    self primitiveFailed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1041
	].
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1042
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1043
	"/ and it must be a kind of ExternalStructure !!
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1044
	(aReceiverOrNil isKindOf:ExternalStructure) ifFalse:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1045
	    self primitiveFailed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1046
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1047
	virtual ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1048
	    vtOffset := name.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1049
	    (vtOffset between:0 and:10000) ifFalse:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1050
		self primitiveFailed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1051
	    ]
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1052
	].
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1053
    ] ifFalse:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1054
	objectiveC ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1055
	    aReceiverOrNil isNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1056
		"/ must have an objective-c object instance
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1057
		self primitiveFailed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1058
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1059
	    (aReceiverOrNil isObjectiveCObject) ifFalse:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1060
		self primitiveFailed
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1061
	    ]
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1062
	] ifFalse:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1063
	    aReceiverOrNil notNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1064
		"/ must NOT have a c++/objectiveC object instance
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1065
		self primitiveFailed.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1066
	    ]
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1067
	].
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1068
    ].
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1069
    async := self isAsync.
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1070
    unlimitedStack := self isUnlimitedStack.
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1071
    callTypeNumber := self callTypeNumber.
10512
5a01829213ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10484
diff changeset
  1072
    "/ Transcript show:name; show:' async:'; showCR:async.
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1073
9459
6cd520c582b3 change from unlimited to big stack, to allow for interrupts to be handled
ca
parents: 9436
diff changeset
  1074
%{  /* STACK: 100000 */
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1075
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1076
#define VERBOSE
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1077
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  1078
#ifdef HAVE_FFI
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1079
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1080
# ifdef __GNUC__
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1081
#  ifndef HAS_LONGLONG
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1082
#   define HAS_LONGLONG
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1083
#  endif
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1084
# endif
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1085
# if defined(__BORLANDC__) || defined(__VISUALC__)
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1086
#  define HAS_INT64
19364
4bf0b2b33b65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19357
diff changeset
  1087
#  ifndef __LO32
4bf0b2b33b65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19357
diff changeset
  1088
#   define __LO32(ll) ((ll) & 0xFFFFFFFFL)
4bf0b2b33b65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19357
diff changeset
  1089
#   define __HI32(ll) (((ll)>>32) & 0xFFFFFFFFL)
4bf0b2b33b65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19357
diff changeset
  1090
#  endif
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1091
# endif
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1092
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1093
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1094
    ffi_cif __cif;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1095
    ffi_type *__argTypesIncludingThis[MAX_ARGS+1];
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1096
    ffi_type **__argTypes = __argTypesIncludingThis;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1097
    ffi_type *__returnType = NULL;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1098
    ffi_type *thisType;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1099
    ffi_abi __callType = FFI_DEFAULT_ABI;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1100
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1101
#else
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1102
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1103
    int __argTypesIncludingThis[MAX_ARGS+1];
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1104
    int *__argTypes = __argTypesIncludingThis;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1105
    int __returnType = 0;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1106
    int thisType;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1107
    int __callType = FFI_DEFAULT_ABI;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1108
19951
2ba5ef097a79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19950
diff changeset
  1109
#endif
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1110
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1111
    int __numFloatOrDoubleArgs = 0;
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1112
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1113
    union u {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1114
	INT iVal;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1115
	float fVal;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1116
	double dVal;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1117
	void *pointerVal;
19365
83a120bf2212 Fix syntax error bug with gcc32
Stefan Vogel <sv@exept.de>
parents: 19364
diff changeset
  1118
# if 0 && defined(HAS_LONGLONG)
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1119
	long long longLongVal;
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1120
# else
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1121
	__int64__ longLongVal;
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1122
# endif
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1123
    };
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1124
    union u __argValuesIncludingThis[MAX_ARGS+1];
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1125
    union u *__argValues = __argValuesIncludingThis;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1126
    union u __returnValue;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1127
    void *__argValuePointersIncludingThis[MAX_ARGS+1];
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1128
    void **__argValuePointers = __argValuePointersIncludingThis;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1129
    void *__returnValuePointer;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1130
    int __numArgs, __numArgsIncludingThis;
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1131
    static INT null = 0;
19341
2ab29dd7ec1a mingw 64bit fixes (xxLL in constants - sigh)
Claus Gittinger <cg@exept.de>
parents: 19334
diff changeset
  1132
    int i = -1;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1133
    VOIDFUNC codeAddress = (VOIDFUNC)__INST(code_);
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1134
    int __numArgsWanted;
12579
516bba5b3e57 changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents: 12504
diff changeset
  1135
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1136
#   define __FAIL__(fcode) \
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1137
    { \
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1138
	failureCode = fcode; failureArgNr = __mkSmallInteger(i+1); goto getOutOfHere; \
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1139
    }
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1140
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1141
    if (argumentsOrNil == nil) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1142
	__numArgs = 0;
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1143
    } else if (__isArray(argumentsOrNil)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1144
	__numArgs = __arraySize(argumentsOrNil);
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1145
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1146
	__FAIL__(@symbol(BadArgumentVector))
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1147
    }
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1148
    if (argTypeSymbols == nil) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1149
	__numArgsWanted = 0;
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1150
    } else if (__isArray(argTypeSymbols)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1151
	__numArgsWanted = __arraySize(argTypeSymbols);
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1152
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1153
	__FAIL__(@symbol(BadArgumentTypeVector))
10440
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1154
    }
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1155
b643af58f8bf invoking without arguments
fm
parents: 10279
diff changeset
  1156
    if (__numArgs != __numArgsWanted) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1157
	__FAIL__(@symbol(ArgumentCountMismatch))
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1158
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1159
    if (__numArgs > MAX_ARGS) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1160
	__FAIL__(@symbol(TooManyArguments))
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1161
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1162
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1163
    /*
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
  1164
     * validate the return type and map it to an ffi_type
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1165
     */
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1166
    __returnValuePointer = &__returnValue;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1167
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  1168
    if (returnTypeSymbol == @symbol(voidPointer)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1169
	returnTypeSymbol = @symbol(handle);
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
  1170
    } else if (returnTypeSymbol == @symbol(hresult)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1171
	returnTypeSymbol = @symbol(uint32);
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  1172
    }
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1173
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1174
    if (returnTypeSymbol == @symbol(int)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1175
	__returnType = TYPE_SINT;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1176
    } else if (returnTypeSymbol == @symbol(uint)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1177
	__returnType = TYPE_UINT;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1178
    } else if (returnTypeSymbol == @symbol(uint8)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1179
	__returnType = TYPE_UINT8;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1180
    } else if (returnTypeSymbol == @symbol(uint16)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1181
	__returnType = TYPE_UINT16;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1182
    } else if (returnTypeSymbol == @symbol(uint32)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1183
	__returnType = TYPE_UINT32;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1184
    } else if (returnTypeSymbol == @symbol(uint64)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1185
	__returnType = TYPE_UINT64;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1186
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1187
    } else if (returnTypeSymbol == @symbol(sint)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1188
	__returnType = TYPE_SINT;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1189
    } else if (returnTypeSymbol == @symbol(sint8)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1190
	__returnType = TYPE_SINT8;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1191
    } else if (returnTypeSymbol == @symbol(sint16)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1192
	__returnType = TYPE_SINT16;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1193
    } else if (returnTypeSymbol == @symbol(sint32)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1194
	__returnType = TYPE_SINT32;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1195
    } else if (returnTypeSymbol == @symbol(sint64)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1196
	__returnType = TYPE_SINT64;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1197
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1198
    } else if (returnTypeSymbol == @symbol(long)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1199
	if (sizeof(long) == 4) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1200
	   returnTypeSymbol = @symbol(sint32);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1201
	   __returnType = TYPE_SINT32;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1202
	} else if (sizeof(long) == 8) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1203
	   returnTypeSymbol = @symbol(sint64);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1204
	   __returnType = TYPE_SINT64;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1205
	} else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1206
	    __FAIL__(@symbol(UnknownReturnType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1207
	}
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1208
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1209
    } else if (returnTypeSymbol == @symbol(ulong)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1210
	if (sizeof(long) == 4) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1211
	   returnTypeSymbol = @symbol(uint32);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1212
	   __returnType = TYPE_UINT32;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1213
	}else if (sizeof(long) == 8) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1214
	   returnTypeSymbol = @symbol(uint64);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1215
	   __returnType = TYPE_UINT64;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1216
	} else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1217
	    __FAIL__(@symbol(UnknownReturnType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1218
	}
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1219
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  1220
    } else if (returnTypeSymbol == @symbol(bool)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1221
	__returnType = TYPE_UINT;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1222
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1223
    } else if (returnTypeSymbol == @symbol(float)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1224
	__returnType = TYPE_FLOAT;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1225
    } else if (returnTypeSymbol == @symbol(double)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1226
	__returnType = TYPE_DOUBLE;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1227
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1228
    } else if (returnTypeSymbol == @symbol(void)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1229
	__returnType = TYPE_VOID;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1230
	__returnValuePointer = NULL;
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  1231
    } else if ((returnTypeSymbol == @symbol(pointer))
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1232
	       || (returnTypeSymbol == @symbol(handle))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1233
	       || (returnTypeSymbol == @symbol(charPointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1234
	       || (returnTypeSymbol == @symbol(bytePointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1235
	       || (returnTypeSymbol == @symbol(floatPointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1236
	       || (returnTypeSymbol == @symbol(doublePointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1237
	       || (returnTypeSymbol == @symbol(intPointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1238
	       || (returnTypeSymbol == @symbol(shortPointer))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1239
	       || (returnTypeSymbol == @symbol(wcharPointer))) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1240
	__returnType = TYPE_POINTER;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1241
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1242
	if (__isSymbol(returnTypeSymbol)
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1243
	 && ((returnValueClass = __GLOBAL_GET(returnTypeSymbol)) != nil)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1244
	    if (! __isBehaviorLike(returnValueClass)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1245
		__FAIL__(@symbol(NonBehaviorReturnType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1246
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1247
	    if (! __qIsSubclassOfExternalAddress(returnValueClass)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1248
		__FAIL__(@symbol(NonExternalAddressReturnType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1249
	    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1250
	    __returnType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1251
	    returnTypeSymbol = @symbol(pointer);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1252
	} else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1253
	    __FAIL__(@symbol(UnknownReturnType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1254
	}
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1255
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1256
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1257
    /*
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1258
     * validate the c++ object
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1259
     */
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  1260
    if (aReceiverOrNil != nil) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1261
	struct cPlusPlusInstance {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1262
	    void **vTable;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1263
	};
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1264
	struct cPlusPlusInstance *inst;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1265
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1266
	if (__isExternalAddressLike(aReceiverOrNil)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1267
	    inst = (void *)(__externalAddressVal(aReceiverOrNil));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1268
	} else if (__isExternalBytesLike(aReceiverOrNil)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1269
	    inst = (void *)(__externalBytesVal(aReceiverOrNil));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1270
	} else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1271
	    __FAIL__(@symbol(InvalidInstance))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1272
	}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1273
	__argValues[0].pointerVal = inst;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1274
	__argValuePointersIncludingThis[0] = &(__argValues[0]);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1275
	__argTypes[0] = TYPE_POINTER;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1276
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1277
	__argValuePointers = &__argValuePointersIncludingThis[1];
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1278
	__argTypes = &__argTypesIncludingThis[1];
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1279
	__argValues = &__argValuesIncludingThis[1];
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1280
	__numArgsIncludingThis = __numArgs + 1;
9347
31adc57e6954 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9346
diff changeset
  1281
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1282
	if (virtual == true) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1283
	    if (! __isSmallInteger(vtOffset)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1284
		__FAIL__(@symbol(InvalidVTableIndex))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1285
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1286
	    codeAddress = inst->vTable[__intVal(vtOffset)];
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1287
	    DEBUGCODE_IF( @global(Verbose), {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1288
		printf("virtual %"_ld_" codeAddress: %"_lx_"\n", (INT)(__intVal(vtOffset)), (INT)codeAddress);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1289
	    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1290
	}
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1291
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1292
	__numArgsIncludingThis = __numArgs;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1293
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1294
	    printf("codeAddress: %"_lx_"\n", (INT)codeAddress);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1295
	})
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1296
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1297
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1298
    /*
19501
4922889c4309 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19494
diff changeset
  1299
     * validate all arg types, map each to an ffi_type, and setup arg-buffers
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1300
     */
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1301
    for (i=0; i<__numArgs; i++) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1302
	void *argValuePtr;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1303
	OBJ typeSymbol;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1304
	OBJ arg;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1305
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1306
	failureInfo = __mkSmallInteger(i+1);   /* in case there is one */
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1307
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1308
	typeSymbol = __ArrayInstPtr(argTypeSymbols)->a_element[i];
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1309
	arg = __ArrayInstPtr(argumentsOrNil)->a_element[i];
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1310
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1311
	if (typeSymbol == @symbol(handle)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1312
	    typeSymbol = @symbol(pointer);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1313
	} else if (typeSymbol == @symbol(voidPointer)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1314
	    typeSymbol = @symbol(pointer);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1315
	} else if (returnTypeSymbol == @symbol(hresult)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1316
	    typeSymbol = @symbol(uint32);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1317
	}
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1318
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1319
	if (typeSymbol == @symbol(long)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1320
	    if (sizeof(long) == sizeof(int)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1321
		typeSymbol = @symbol(sint);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1322
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1323
		if (sizeof(long) == 4) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1324
		    typeSymbol = @symbol(sint32);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1325
		} else if (sizeof(long) == 8) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1326
		    typeSymbol = @symbol(sint64);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1327
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1328
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1329
	}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1330
	if (typeSymbol == @symbol(ulong)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1331
	    if (sizeof(unsigned long) == sizeof(unsigned int)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1332
		typeSymbol = @symbol(uint);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1333
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1334
		if (sizeof(long) == 4) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1335
		    typeSymbol = @symbol(uint32);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1336
		} else if (sizeof(long) == 8) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1337
		    typeSymbol = @symbol(uint64);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1338
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1339
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1340
	}
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1341
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1342
	if (typeSymbol == @symbol(int) || typeSymbol == @symbol(sint)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1343
	    thisType = TYPE_SINT;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1344
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1345
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1346
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1347
		__argValues[i].iVal = __signedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1348
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1349
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1350
			printf("invalidArgument: arg%d sint value out of range [%d]\n", i+1, __LINE__);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1351
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1352
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1353
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1354
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1355
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1356
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1357
	} else if (typeSymbol == @symbol(uint)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1358
	    thisType = TYPE_UINT;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1359
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1360
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1361
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1362
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1363
		__argValues[i].iVal = __unsignedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1364
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1365
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1366
			printf("invalidArgument: arg%d uint value out of range [%d]\n", i+1, __LINE__);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1367
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1368
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1369
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1370
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1371
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1372
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1373
	} else if (typeSymbol == @symbol(uint8)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1374
	    thisType = TYPE_UINT8;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1375
	    if (! __isSmallInteger(arg)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1376
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1377
		    printf("invalidArgument: arg%d uint8 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1378
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1379
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1380
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1381
	    __argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1382
	    if (((unsigned)(__argValues[i].iVal)) > 0xFF) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1383
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1384
		    printf("invalidArgument: arg%d uint8 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1385
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1386
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1387
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1388
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1389
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1390
	} else if (typeSymbol == @symbol(sint8)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1391
	    thisType = TYPE_SINT8;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1392
	    if (! __isSmallInteger(arg)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1393
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1394
		    printf("invalidArgument: arg%d sint8 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1395
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1396
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1397
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1398
	    __argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1399
	    if (((__argValues[i].iVal) < -0x80) || ((__argValues[i].iVal) > 0x7F))  {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1400
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1401
		    printf("invalidArgument: arg%d sint8 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1402
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1403
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1404
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1405
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1406
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1407
	} else if (typeSymbol == @symbol(uint16)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1408
	    thisType = TYPE_UINT16;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1409
	    if (! __isSmallInteger(arg)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1410
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1411
		    printf("invalidArgument: arg%d uint16 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1412
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1413
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1414
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1415
	    __argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1416
	    if (((unsigned)(__argValues[i].iVal)) > 0xFFFF) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1417
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1418
		    printf("invalidArgument: arg%d uint16 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1419
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1420
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1421
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1422
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1423
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1424
	} else if (typeSymbol == @symbol(sint16)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1425
	    thisType = TYPE_SINT16;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1426
	    if (! __isSmallInteger(arg)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1427
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1428
		    printf("invalidArgument: arg%d sint16 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1429
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1430
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1431
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1432
	    __argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1433
	    if (((__argValues[i].iVal) < -0x8000) || ((__argValues[i].iVal) > 0x7FFF))  {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1434
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1435
		    printf("invalidArgument: arg%d sint16 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1436
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1437
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1438
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1439
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1440
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1441
	} else if (typeSymbol == @symbol(uint32)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1442
	    thisType = TYPE_UINT32;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1443
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1444
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1445
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1446
		__argValues[i].iVal = __unsignedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1447
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1448
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1449
			printf("invalidArgument: arg%d uint32 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1450
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1451
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1452
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1453
	    }
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1454
# if __POINTER_SIZE__ == 8
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1455
	    if ((__argValues[i].iVal) < 0)  {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1456
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1457
		    printf("invalidArgument: arg%d uint32 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1458
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1459
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1460
	    }
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1461
# endif
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1462
	    argValuePtr = &(__argValues[i].iVal);
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1463
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1464
	 } else if (typeSymbol == @symbol(sint32)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1465
	    thisType = TYPE_SINT32;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1466
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1467
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1468
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1469
		__argValues[i].iVal = __signedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1470
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1471
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1472
			printf("invalidArgument: arg%d sint32 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1473
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1474
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1475
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1476
	    }
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1477
# if __POINTER_SIZE__ == 8
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1478
	    if (((__argValues[i].iVal) < -0x80000000LL) || ((__argValues[i].iVal) > 0x7FFFFFFFLL))  {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1479
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1480
		    printf("invalidArgument: arg%d sint32 value (%"_lx_") out of range [%d]\n", i+1, __argValues[i].iVal, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1481
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1482
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1483
	    }
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1484
# endif
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1485
	    argValuePtr = &(__argValues[i].iVal);
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1486
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1487
	} else if (typeSymbol == @symbol(uint64)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1488
	    thisType = TYPE_UINT64;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1489
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1490
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1491
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1492
		__argValues[i].iVal = __unsignedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1493
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1494
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1495
			printf("invalidArgument: arg%d uint64 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1496
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1497
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1498
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1499
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1500
	    argValuePtr = &(__argValues[i].iVal);
19334
0488e4bae939 mingw 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 19314
diff changeset
  1501
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1502
	 } else if (typeSymbol == @symbol(sint64)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1503
	    thisType = TYPE_SINT64;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1504
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1505
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1506
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1507
		__argValues[i].iVal = __signedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1508
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1509
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1510
			printf("invalidArgument: arg%d sint64 value out of range [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1511
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1512
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1513
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1514
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1515
	    argValuePtr = &(__argValues[i].iVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1516
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1517
	} else if (typeSymbol == @symbol(float)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1518
	    thisType = TYPE_FLOAT;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1519
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1520
		__argValues[i].fVal = (float)(__intVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1521
	    } else if (__isFloat(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1522
		__argValues[i].fVal = (float)(__floatVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1523
	    } else if (__isShortFloat(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1524
		__argValues[i].fVal = (float)(__shortFloatVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1525
	    } else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1526
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1527
		    printf("invalidArgument: arg%d non float value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1528
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1529
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1530
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1531
	    argValuePtr = &(__argValues[i].fVal);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1532
	} else if (typeSymbol == @symbol(double)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1533
	    thisType = TYPE_DOUBLE;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1534
	    if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1535
		__argValues[i].dVal = (double)(__intVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1536
	    } else if (__isFloat(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1537
		__argValues[i].dVal = (double)(__floatVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1538
	    } else if (__isShortFloat(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1539
		__argValues[i].dVal = (double)(__shortFloatVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1540
	    } else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1541
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1542
		    printf("invalidArgument: arg%d non double value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1543
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1544
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1545
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1546
	    argValuePtr = &(__argValues[i].dVal);
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1547
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1548
	} else if (typeSymbol == @symbol(void)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1549
	    thisType = TYPE_VOID;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1550
	    argValuePtr = &null;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1551
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1552
	} else if (typeSymbol == @symbol(charPointer)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1553
	    thisType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1554
	    if (__isStringLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1555
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1556
		__argValues[i].pointerVal = (void *)(__stringVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1557
	    } else if (__isBytes(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1558
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1559
		__argValues[i].pointerVal = (void *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1560
	    } else if (__isExternalAddressLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1561
		__argValues[i].pointerVal = (void *)(__externalAddressVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1562
	    } else if (__isExternalBytesLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1563
		__argValues[i].pointerVal = (void *)(__externalBytesVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1564
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1565
		if (arg == nil) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1566
		    __argValues[i].pointerVal = (void *)0;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1567
		} else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1568
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1569
			printf("invalidArgument: arg%d non charPointer value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1570
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1571
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1572
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1573
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1574
	    argValuePtr = &(__argValues[i].pointerVal);;
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1575
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1576
	} else if (typeSymbol == @symbol(wcharPointer)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1577
	    thisType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1578
	    if (__isUnicode16String(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1579
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1580
		__argValues[i].pointerVal = (void *)(__unicode16StringVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1581
	    } else if (__isBytes(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1582
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1583
		__argValues[i].pointerVal = (void *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1584
	    } else if (__isExternalAddressLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1585
		__argValues[i].pointerVal = (void *)(__externalAddressVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1586
	    } else if (__isExternalBytesLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1587
		__argValues[i].pointerVal = (void *)(__externalBytesVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1588
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1589
		if (arg == nil) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1590
		    __argValues[i].pointerVal = (void *)0;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1591
		} else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1592
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1593
			printf("invalidArgument: arg%d non wcharPointer value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1594
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1595
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1596
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1597
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1598
	    argValuePtr = &(__argValues[i].pointerVal);;
12656
e7854486b4ff wcharPointer arguments
Claus Gittinger <cg@exept.de>
parents: 12591
diff changeset
  1599
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1600
	} else if (typeSymbol == @symbol(floatPointer)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1601
	    thisType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1602
	    if (__isBytes(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1603
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1604
		__argValues[i].pointerVal = (void *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1605
	    } else if (__isExternalAddressLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1606
		__argValues[i].pointerVal = (void *)(__externalAddressVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1607
	    } else if (__isExternalBytesLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1608
		__argValues[i].pointerVal = (void *)(__externalBytesVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1609
	    } else if (__isFloats(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1610
		char *p = (char *)(__FloatArrayInstPtr(arg)->f_element);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1611
		int nInstBytes;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1612
		OBJ cls;
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1613
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1614
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1615
		cls = __qClass(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1616
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1617
		p = p + nInstBytes;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1618
		__argValues[i].pointerVal = p;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1619
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1620
		if (arg == nil) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1621
		    __argValues[i].pointerVal = (void *)0;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1622
		} else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1623
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1624
			printf("invalidArgument: arg%d non floatPointer value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1625
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1626
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1627
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1628
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1629
	    argValuePtr = &(__argValues[i].pointerVal);;
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1630
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1631
	} else if (typeSymbol == @symbol(doublePointer)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1632
	    thisType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1633
	    if (__isBytes(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1634
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1635
		__argValues[i].pointerVal = (void *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1636
	    } else if (__isExternalAddressLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1637
		__argValues[i].pointerVal = (void *)(__externalAddressVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1638
	    } else if (__isExternalBytesLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1639
		__argValues[i].pointerVal = (void *)(__externalBytesVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1640
	    } else if (__isDoubles(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1641
		char *p = (char *)(__DoubleArrayInstPtr(arg)->d_element);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1642
		int nInstBytes;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1643
		OBJ cls;
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1644
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1645
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1646
		cls = __qClass(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1647
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1648
		p = p + nInstBytes;
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1649
# ifdef __NEED_DOUBLE_ALIGN
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1650
		if ((INT)(__DoubleArrayInstPtr(arg)->d_element) & (__DOUBLE_ALIGN-1)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1651
		    int delta = __DOUBLE_ALIGN - ((INT)p & (__DOUBLE_ALIGN-1));
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  1652
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1653
		    p += delta;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1654
		}
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  1655
# endif
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1656
		__argValues[i].pointerVal = p;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1657
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1658
		if (arg == nil) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1659
		    __argValues[i].pointerVal = (void *)0;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1660
		} else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1661
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1662
			printf("invalidArgument: arg%d non doublePointer value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1663
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1664
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1665
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1666
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1667
	    argValuePtr = &(__argValues[i].pointerVal);;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1668
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1669
	} else if (typeSymbol == @symbol(pointer)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1670
    commonPointerTypeArg: ;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1671
	    thisType = TYPE_POINTER;
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1672
	    if (arg == nil) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1673
		__argValues[i].pointerVal = NULL;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1674
	    } else if (__isExternalAddressLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1675
		__argValues[i].pointerVal = (void *)(__externalAddressVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1676
	    } else if (__isExternalBytesLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1677
		__argValues[i].pointerVal = (void *)(__externalBytesVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1678
	    } else if (__isByteArrayLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1679
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1680
		__argValues[i].pointerVal = (void *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1681
	    } else if (__isWordArray(arg) || __isSignedWordArray(arg)
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1682
		    || __isIntegerArray(arg) || __isSignedIntegerArray(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1683
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1684
		__argValues[i].pointerVal = (void *)(__integerArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1685
	    } else if (__isFloatArray(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1686
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1687
		__argValues[i].pointerVal = (void *)(__FloatArrayInstPtr(arg)->f_element);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1688
	    } else if (__isDoubleArray(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1689
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1690
		__argValues[i].pointerVal = (void *)(__DoubleArrayInstPtr(arg)->d_element);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1691
	    } else if (__isStringLike(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1692
		if (async == true) {
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
  1693
badArgForAsyncCall: ;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1694
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1695
			printf("invalidArgument: arg%d not allowed for async call [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1696
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1697
		    __FAIL__(@symbol(BadArgForAsyncCall))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1698
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1699
		__argValues[i].pointerVal = (void *)(__stringVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1700
	    } else if (__isBytes(arg) || __isWords(arg) || __isLongs(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1701
		char *p = (char *)(__byteArrayVal(arg));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1702
		int nInstBytes;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1703
		OBJ cls;
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  1704
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1705
		if (async == true) goto badArgForAsyncCall;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1706
		cls = __qClass(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1707
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1708
		__argValues[i].pointerVal = p + nInstBytes;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1709
	    } else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1710
		DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1711
		    printf("invalidArgument: arg%d non pointer value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1712
		})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1713
		__FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1714
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1715
	    argValuePtr = &(__argValues[i].pointerVal);;
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  1716
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1717
	} else if (typeSymbol == @symbol(bool)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1718
	    thisType = TYPE_UINT;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1719
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1720
	    if (arg == true) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1721
		__argValues[i].iVal = 1;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1722
	    } else if (arg == false) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1723
		__argValues[i].iVal = 0;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1724
	    } else if (__isSmallInteger(arg)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1725
		__argValues[i].iVal = __intVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1726
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1727
		__argValues[i].iVal = __unsignedLongIntVal(arg);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1728
		if (__argValues[i].iVal == 0) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1729
		    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1730
			printf("invalidArgument: arg%d non bool value [%d]\n", i+1, __LINE__);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1731
		    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1732
		    __FAIL__(@symbol(InvalidArgument))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1733
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1734
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1735
	    argValuePtr = &(__argValues[i].iVal);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1736
	} else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1737
	    if (__isSymbol(typeSymbol)
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1738
	     && ((argValueClass = __GLOBAL_GET(typeSymbol)) != nil)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1739
		if (! __isBehaviorLike(argValueClass)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1740
		    __FAIL__(@symbol(NonBehaviorArgumentType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1741
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1742
		if (! __qIsSubclassOfExternalAddress(argValueClass)) {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1743
		    __FAIL__(@symbol(NonExternalAddressArgumentType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1744
		}
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1745
		goto commonPointerTypeArg; /* sorry */
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1746
	    } else {
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1747
		__FAIL__(@symbol(UnknownArgumentType))
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1748
	    }
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1749
	}
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1750
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1751
	__argTypes[i] = thisType;
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1752
	__argValuePointers[i] = argValuePtr;
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  1753
19932
7fb01b7aff42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19931
diff changeset
  1754
	if ((thisType == TYPE_FLOAT) || (thisType == TYPE_DOUBLE)) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1755
	    __numFloatOrDoubleArgs++;
19932
7fb01b7aff42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19931
diff changeset
  1756
	}
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1757
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1758
	    printf("arg%d: %"_lx_" type:%"_lx_"\n", i+1, (INT)(__argValues[i].iVal), (INT)thisType);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1759
	})
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1760
    }
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1761
    failureInfo = nil;
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1762
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1763
    if (callTypeNumber == @global(CALLTYPE_API)) {
20288
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1764
#  ifdef __MINGW64__
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1765
	__callType = FFI_DEFAULT_ABI;
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1766
#  else
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1767
#   ifdef CALLTYPE_FFI_STDCALL
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1768
	__callType = CALLTYPE_FFI_STDCALL;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1769
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1770
	    printf("STDCALL\n");
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1771
	})
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1772
	failureCode = @symbol(FFICallTypeNotSupported);
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1773
	goto getOutOfHere;
20288
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1774
#   endif
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1775
#  endif
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1776
    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1777
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1778
    // these calltypes are only supported on some systems; others report an error
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1779
    if (callTypeNumber == @global(CALLTYPE_V8)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1780
#  ifdef CALLTYPE_FFI_V8
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1781
	__callType = CALLTYPE_FFI_V8;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1782
#  else
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1783
	failureCode = @symbol(FFICallTypeNotSupported);
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1784
	goto getOutOfHere;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1785
#  endif
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1786
    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1787
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1788
    if (callTypeNumber == @global(CALLTYPE_V9)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1789
#  ifdef CALLTYPE_FFI_V9
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1790
	__callType = CALLTYPE_FFI_V9;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1791
#  else
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1792
	failureCode = @symbol(FFICallTypeNotSupported);
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1793
	goto getOutOfHere;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1794
#  endif
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1795
    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1796
9465
d11885052713 rewrite & cleanup
Claus Gittinger <cg@exept.de>
parents: 9464
diff changeset
  1797
    if (callTypeNumber == @global(CALLTYPE_UNIX64)) {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1798
#  ifdef CALLTYPE_FFI_UNIX64
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1799
	__callType = CALLTYPE_FFI_UNIX64;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1800
#  else
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1801
	failureCode = @symbol(FFICallTypeNotSupported);
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1802
	goto getOutOfHere;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1803
#  endif
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1804
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1805
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1806
# ifdef HAVE_FFI
20288
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1807
#  ifdef VERBOSE
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1808
    if (@global(Verbose) == true) {
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1809
	printf("prep: numargs=%d\n", __numArgsIncludingThis);
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1810
    }
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1811
#  endif
604e46cfbf18 ffi for mingw - 64-bit machine has no API_CALL
Claus Gittinger <cg@exept.de>
parents: 19951
diff changeset
  1812
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1813
    if (ffi_prep_cif(&__cif, __callType, __numArgsIncludingThis, __returnType, __argTypesIncludingThis) != FFI_OK) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1814
	__FAIL__(@symbol(FFIPrepareFailed))
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  1815
    }
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  1816
    if (async == true) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1817
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1818
	    printf("async call 0x%"_lx_"\n", (INT)codeAddress);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1819
	})
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1820
#  ifdef __win32__
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1821
	__STX_C_CALL4( "ffi_call", ffi_call, &__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis);
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1822
#  else
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1823
	__BEGIN_INTERRUPTABLE__
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1824
	ffi_call(&__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1825
	__END_INTERRUPTABLE__
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1826
#  endif
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
  1827
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1828
	if (unlimitedStack == true) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1829
	    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1830
		printf("UNLIMITEDSTACKCALL call 0x%"_lx_"\n", (INT)codeAddress);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1831
	    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1832
	    __UNLIMITEDSTACKCALL4__((OBJFUNC)ffi_call, (INT)(&__cif), (INT)codeAddress, (INT)__returnValuePointer, (INT)__argValuePointersIncludingThis);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1833
	} else {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1834
	    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1835
		printf("call 0x%"_lx_"\n", (INT)codeAddress);
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1836
	    })
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1837
	    ffi_call(&__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis);
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  1838
	}
9435
68f7e39efad7 support of asynchronous calls
ca
parents: 9418
diff changeset
  1839
    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1840
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1841
# else /* NO FFI */
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1842
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1843
    // this is a fallback; simply assume that pointer and regular args
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1844
    // can be passed in the same registers, and that all args are casted to the same
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1845
    // (pointer-) size.
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1846
    // Also, that float/doubles are passed down in regular registers,
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1847
    // and the return types float and double are handled diferently from ints.
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1848
    // If that is not correct for your CPU/architecture, an ifndef is required here.
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1849
    // No longer limited to non-double args: for x86_64, sort by non-float/float args and
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1850
    // pass down separately.
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1851
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1852
    {
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1853
	VOIDPTRFUNC fi = (VOIDPTRFUNC)codeAddress;
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1854
	DOUBLEFUNC fd = (DOUBLEFUNC)codeAddress;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1855
	int rI[MAX_ARGS], dI[MAX_ARGS];
20295
87dc882749b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 20290
diff changeset
  1856
	int i;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1857
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1858
	// sort the float/double args into a separate arglist and pass them AFTER the regular args.
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1859
	// This is possible, because all doubles are passed in floating-pnt registers,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1860
	// no matter where they are in the arglist.
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1861
	int argI = 0, nonDoubleI = 0, doubleI = 0;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1862
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1863
	for (argI=0; argI<__numArgsIncludingThis; argI++) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1864
#  if defined(__x86_64__)
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1865
	    if ((__argTypesIncludingThis[argI] == TYPE_DOUBLE)
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1866
	     || (__argTypesIncludingThis[argI] == TYPE_FLOAT)) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1867
		dI[doubleI++] = argI;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1868
	    } else
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1869
#  endif // __x86_64__
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1870
	    {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1871
		rI[nonDoubleI++] = argI;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1872
	    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1873
	}
20295
87dc882749b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 20290
diff changeset
  1874
	for (i=doubleI; i<__numArgsIncludingThis; i++) dI[doubleI++] = 0;
87dc882749b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 20290
diff changeset
  1875
	for (i=nonDoubleI; i<__numArgsIncludingThis; i++) rI[nonDoubleI++] = 0;
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1876
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1877
	DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1878
	    printf("call %p with %d args (%d regular, %d double)\n", codeAddress, __numArgsIncludingThis,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1879
								     nonDoubleI, doubleI);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1880
	})
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1881
	if (doubleI == 0) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1882
	    // no double args
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1883
	    switch (__returnType) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1884
		case TYPE_FLOAT:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1885
		case TYPE_DOUBLE:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1886
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1887
			printf("non-double arg; double retval\n");
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1888
		    })
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1889
		    switch (__numArgsIncludingThis) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1890
			case 0:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1891
			    __returnValue.dVal = (*fd)();
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1892
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1893
			case 1:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1894
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1895
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1896
			case 2:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1897
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1898
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1899
			case 3:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1900
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1901
							__argValues[rI[2]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1902
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1903
			case 4:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1904
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1905
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1906
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1907
			case 5:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1908
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1909
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1910
							__argValues[rI[4]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1911
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1912
			case 6:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1913
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1914
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1915
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1916
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1917
			case 7:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1918
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1919
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1920
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1921
							__argValues[rI[6]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1922
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1923
			case 8:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1924
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1925
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1926
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1927
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1928
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1929
			case 9:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1930
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1931
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1932
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1933
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1934
							__argValues[rI[8]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1935
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1936
			case 10:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1937
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1938
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1939
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1940
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1941
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1942
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1943
			case 11:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1944
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1945
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1946
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1947
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1948
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1949
							__argValues[rI[10]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1950
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1951
			case 12:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1952
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1953
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1954
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1955
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1956
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1957
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1958
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1959
			case 13:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1960
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1961
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1962
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1963
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1964
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1965
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1966
							__argValues[rI[12]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1967
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1968
			case 14:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1969
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1970
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1971
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1972
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1973
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1974
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1975
							__argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1976
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1977
			case 15:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1978
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1979
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1980
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1981
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1982
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1983
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1984
							__argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1985
							__argValues[rI[14]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1986
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1987
			default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1988
			    failureCode = @symbol(TooManyArguments);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1989
			    goto getOutOfHere;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1990
		    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1991
		    break;
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  1992
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1993
		default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1994
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1995
			printf("non-double arg; non-double retval\n");
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1996
		    })
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1997
		    switch (__numArgsIncludingThis) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1998
			case 0:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  1999
			    __returnValue.pointerVal = (*fi)();
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2000
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2001
			case 1:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2002
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2003
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2004
			case 2:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2005
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2006
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2007
			case 3:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2008
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2009
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2010
			case 4:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2011
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2012
							     __argValues[rI[3]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2013
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2014
			case 5:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2015
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2016
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2017
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2018
			case 6:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2019
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2020
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2021
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2022
			case 7:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2023
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2024
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2025
							     __argValues[rI[6]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2026
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2027
			case 8:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2028
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2029
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2030
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2031
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2032
			case 9:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2033
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2034
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2035
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2036
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2037
			case 10:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2038
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2039
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2040
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2041
							     __argValues[rI[9]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2042
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2043
			case 11:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2044
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2045
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2046
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2047
							     __argValues[rI[9]].pointerVal, __argValues[rI[10]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2048
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2049
			case 12:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2050
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2051
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2052
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2053
							     __argValues[rI[9]].pointerVal, __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2054
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2055
			case 13:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2056
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2057
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2058
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2059
							     __argValues[rI[9]].pointerVal, __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2060
							     __argValues[rI[12]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2061
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2062
			case 14:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2063
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2064
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2065
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2066
							     __argValues[rI[9]].pointerVal, __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2067
							     __argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2068
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2069
			case 15:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2070
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal, __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2071
							     __argValues[rI[3]].pointerVal, __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2072
							     __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal, __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2073
							     __argValues[rI[9]].pointerVal, __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2074
							     __argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal, __argValues[rI[14]].pointerVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2075
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2076
			default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2077
			    failureCode = @symbol(TooManyArguments);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2078
			    goto getOutOfHere;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2079
		    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2080
	    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2081
	} else {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2082
	    // has double args
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2083
	    switch (__returnType) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2084
		case TYPE_FLOAT:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2085
		case TYPE_DOUBLE:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2086
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2087
			printf("double arg(s); double retval\n");
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2088
		    })
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2089
		    switch (__numArgsIncludingThis) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2090
			case 0:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2091
			    __returnValue.dVal = (*fd)( );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2092
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2093
			case 1:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2094
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2095
							__argValues[dI[0]].dVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2096
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2097
			case 2:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2098
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2099
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2100
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2101
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2102
			case 3:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2103
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2104
							__argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2105
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2106
							__argValues[dI[2]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2107
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2108
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2109
			case 4:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2110
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2111
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2112
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2113
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2114
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2115
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2116
			case 5:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2117
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2118
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2119
							__argValues[rI[4]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2120
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2121
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2122
							__argValues[dI[4]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2123
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2124
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2125
			case 6:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2126
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2127
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2128
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2129
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2130
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2131
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2132
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2133
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2134
			case 7:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2135
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2136
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2137
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2138
							__argValues[rI[6]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2139
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2140
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2141
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2142
							__argValues[dI[6]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2143
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2144
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2145
			case 8:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2146
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2147
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2148
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2149
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2150
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2151
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2152
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2153
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2154
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2155
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2156
			case 9:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2157
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2158
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2159
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2160
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2161
							__argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2162
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2163
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2164
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2165
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2166
							__argValues[dI[8]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2167
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2168
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2169
			case 10:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2170
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2171
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2172
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2173
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2174
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2175
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2176
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2177
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2178
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2179
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2180
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2181
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2182
			case 11:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2183
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2184
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2185
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2186
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2187
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2188
							__argValues[rI[10]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2189
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2190
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2191
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2192
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2193
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2194
							__argValues[dI[10]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2195
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2196
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2197
			case 12:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2198
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2199
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2200
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2201
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2202
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2203
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2204
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2205
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2206
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2207
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2208
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2209
							__argValues[dI[10]].dVal, __argValues[dI[11]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2210
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2211
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2212
			case 13:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2213
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2214
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2215
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2216
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2217
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2218
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2219
							__argValues[rI[12]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2220
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2221
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2222
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2223
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2224
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2225
							__argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2226
							__argValues[dI[12]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2227
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2228
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2229
			case 14:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2230
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2231
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2232
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2233
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2234
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2235
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2236
							__argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2237
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2238
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2239
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2240
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2241
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2242
							__argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2243
							__argValues[dI[12]].dVal, __argValues[dI[13]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2244
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2245
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2246
			case 15:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2247
			    __returnValue.dVal = (*fd)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2248
							__argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2249
							__argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2250
							__argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2251
							__argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2252
							__argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2253
							__argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2254
							__argValues[rI[14]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2255
							__argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2256
							__argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2257
							__argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2258
							__argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2259
							__argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2260
							__argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2261
							__argValues[dI[12]].dVal, __argValues[dI[13]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2262
							__argValues[dI[14]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2263
						      );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2264
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2265
			default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2266
			    failureCode = @symbol(TooManyArguments);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2267
			    goto getOutOfHere;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2268
		    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2269
		    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2270
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2271
		default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2272
		    DEBUGCODE_IF( @global(Verbose), {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2273
			printf("double arg(s); non-double retval\n");
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2274
		    })
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2275
		    switch (__numArgsIncludingThis) {
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2276
			case 0:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2277
			    __returnValue.pointerVal = (*fi)( );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2278
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2279
			case 1:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2280
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2281
							      __argValues[dI[0]].dVal );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2282
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2283
			case 2:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2284
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2285
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2286
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2287
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2288
			case 3:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2289
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2290
							      __argValues[rI[2]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2291
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2292
							      __argValues[dI[2]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2293
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2294
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2295
			case 4:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2296
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2297
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2298
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2299
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2300
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2301
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2302
			case 5:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2303
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2304
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2305
							      __argValues[rI[4]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2306
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2307
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2308
							      __argValues[dI[4]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2309
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2310
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2311
			case 6:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2312
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2313
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2314
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2315
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2316
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2317
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2318
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2319
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2320
			case 7:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2321
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2322
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2323
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2324
							      __argValues[rI[6]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2325
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2326
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2327
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2328
							      __argValues[dI[6]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2329
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2330
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2331
			case 8:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2332
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2333
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2334
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2335
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2336
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2337
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2338
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2339
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2340
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2341
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2342
			case 9:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2343
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2344
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2345
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2346
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2347
							      __argValues[rI[8]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2348
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2349
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2350
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2351
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2352
							      __argValues[dI[8]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2353
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2354
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2355
			case 10:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2356
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2357
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2358
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2359
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2360
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2361
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2362
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2363
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2364
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2365
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2366
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2367
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2368
			case 11:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2369
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2370
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2371
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2372
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2373
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2374
							      __argValues[rI[10]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2375
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2376
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2377
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2378
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2379
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2380
							      __argValues[dI[10]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2381
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2382
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2383
			case 12:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2384
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2385
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2386
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2387
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2388
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2389
							      __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2390
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2391
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2392
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2393
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2394
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2395
							      __argValues[dI[10]].dVal, __argValues[dI[11]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2396
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2397
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2398
			case 13:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2399
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2400
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2401
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2402
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2403
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2404
							      __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2405
							      __argValues[rI[12]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2406
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2407
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2408
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2409
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2410
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2411
							      __argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2412
							      __argValues[dI[12]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2413
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2414
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2415
			case 14:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2416
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2417
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2418
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2419
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2420
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2421
							      __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2422
							      __argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2423
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2424
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2425
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2426
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2427
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2428
							      __argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2429
							      __argValues[dI[12]].dVal, __argValues[dI[13]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2430
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2431
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2432
			case 15:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2433
			    __returnValue.pointerVal = (*fi)( __argValues[rI[0]].pointerVal, __argValues[rI[1]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2434
							      __argValues[rI[2]].pointerVal, __argValues[rI[3]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2435
							      __argValues[rI[4]].pointerVal, __argValues[rI[5]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2436
							      __argValues[rI[6]].pointerVal, __argValues[rI[7]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2437
							      __argValues[rI[8]].pointerVal, __argValues[rI[9]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2438
							      __argValues[rI[10]].pointerVal, __argValues[rI[11]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2439
							      __argValues[rI[12]].pointerVal, __argValues[rI[13]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2440
							      __argValues[rI[14]].pointerVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2441
							      __argValues[dI[0]].dVal, __argValues[dI[1]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2442
							      __argValues[dI[2]].dVal, __argValues[dI[3]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2443
							      __argValues[dI[4]].dVal, __argValues[dI[5]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2444
							      __argValues[dI[6]].dVal, __argValues[dI[7]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2445
							      __argValues[dI[8]].dVal, __argValues[dI[9]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2446
							      __argValues[dI[10]].dVal, __argValues[dI[11]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2447
							      __argValues[dI[12]].dVal, __argValues[dI[13]].dVal,
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2448
							      __argValues[dI[14]].dVal
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2449
							    );
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2450
			    break;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2451
			default:
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2452
			    failureCode = @symbol(TooManyArguments);
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2453
			    goto getOutOfHere;
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2454
		    }
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2455
	    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2456
	}
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2457
    }
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2458
# endif // alternative to FFI
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2459
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2460
    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2461
	printf("retval is %"_ld_" (0x%"_lx_")\n", (INT)(__returnValue.iVal), (INT)(__returnValue.iVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2462
    })
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
  2463
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  2464
    if ((returnTypeSymbol == @symbol(int))
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  2465
     || (returnTypeSymbol == @symbol(sint))
9479
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  2466
     || (returnTypeSymbol == @symbol(sint8))
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  2467
     || (returnTypeSymbol == @symbol(sint16))
68d12a181d4a handle types; sint32 types.
ca
parents: 9466
diff changeset
  2468
     || (returnTypeSymbol == @symbol(sint32))) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2469
	DEBUGCODE_IF( @global(Verbose), {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2470
	    printf("return int: %"_lx_"\n", (INT)(__returnValue.iVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2471
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2472
	RETURN ( __MKINT(__returnValue.iVal) );
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2473
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2474
    if ((returnTypeSymbol == @symbol(uint))
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2475
     || (returnTypeSymbol == @symbol(uint8))
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2476
     || (returnTypeSymbol == @symbol(uint16))
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2477
     || (returnTypeSymbol == @symbol(uint32))) {
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2478
	DEBUGCODE_IF( @global(Verbose), {
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2479
	    printf("return uint: %"_lx_"\n", (INT)(__returnValue.iVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2480
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2481
	RETURN ( __MKUINT(__returnValue.iVal) );
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2482
    }
10025
053904a63549 stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents: 9981
diff changeset
  2483
    if (returnTypeSymbol == @symbol(bool)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2484
	RETURN ( __returnValue.iVal ? true : false );
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2485
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2486
    if (returnTypeSymbol == @symbol(float)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2487
	RETURN ( __MKFLOAT(__returnValue.fVal ));
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2488
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2489
    if (returnTypeSymbol == @symbol(double)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2490
	RETURN ( __MKFLOAT(__returnValue.dVal ));
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2491
    }
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2492
    if (returnTypeSymbol == @symbol(void)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2493
	RETURN ( nil );
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2494
    }
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2495
    if (returnTypeSymbol == @symbol(char)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2496
	RETURN ( __MKCHARACTER(__returnValue.iVal & 0xFF) );
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2497
    }
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2498
    if (returnTypeSymbol == @symbol(wchar)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2499
	RETURN ( __MKUCHARACTER(__returnValue.iVal & 0xFFFF) );
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  2500
    }
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  2501
    if (returnTypeSymbol == @symbol(sint64)) {
19356
5ca3989a13f0 bcc fixes
Claus Gittinger <cg@exept.de>
parents: 19355
diff changeset
  2502
# if (__POINTER_SIZE__ == 8)
19355
58ef1e6a54f9 fix for bcc
Claus Gittinger <cg@exept.de>
parents: 19343
diff changeset
  2503
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2504
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2505
	    printf("return sint64: %"_lx_"\n", (INT)(__returnValue.longLongVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2506
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2507
	RETURN ( __MKINT(__returnValue.longLongVal) );
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
  2508
# else
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2509
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2510
	    printf("return sint64: %lx%08lx\n", __HI32(__returnValue.longLongVal), __LO32(__returnValue.longLongVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2511
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2512
	RETURN ( __MKINT64(&__returnValue.longLongVal) );
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
  2513
# endif
12504
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  2514
    }
c9987bb76eb6 untested long long return value
Claus Gittinger <cg@exept.de>
parents: 12503
diff changeset
  2515
    if (returnTypeSymbol == @symbol(uint64)) {
19356
5ca3989a13f0 bcc fixes
Claus Gittinger <cg@exept.de>
parents: 19355
diff changeset
  2516
# if (__POINTER_SIZE__ == 8)
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2517
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2518
	    printf("return uint64: %"_lx_"\n", (unsigned INT)(__returnValue.longLongVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2519
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2520
	RETURN ( __MKUINT(__returnValue.longLongVal) );
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
  2521
# else
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2522
	DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2523
	    printf("return sint64: %lx%08lx\n", __HI32(__returnValue.longLongVal), __LO32(__returnValue.longLongVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2524
	})
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2525
	RETURN ( __MKUINT64(&__returnValue.longLongVal) );
19314
698cf296ef6d mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents: 19313
diff changeset
  2526
# endif
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2527
    }
11586
a3b2eef8a74c int vs. sint
Claus Gittinger <cg@exept.de>
parents: 11426
diff changeset
  2528
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2529
    DEBUGCODE_IF( @global(Verbose), {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2530
	printf("return pointer: %"_lx_"\n", (INT)(__returnValue.pointerVal));
20290
952d5b62a161 implemented a non-FFI-based callout scheme which works with OSX
Claus Gittinger <cg@exept.de>
parents: 20289
diff changeset
  2531
    })
9346
a95e2cf0e56f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9344
diff changeset
  2532
    if (returnTypeSymbol == @symbol(handle)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2533
	returnValue = __MKEXTERNALADDRESS(__returnValue.pointerVal);
9346
a95e2cf0e56f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9344
diff changeset
  2534
    } else if (returnTypeSymbol == @symbol(pointer)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2535
	returnValue = __MKEXTERNALBYTES(__returnValue.pointerVal);
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2536
    } else if (returnTypeSymbol == @symbol(bytePointer)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2537
	returnValue = __MKEXTERNALBYTES(__returnValue.pointerVal);
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2538
    } else if (returnTypeSymbol == @symbol(charPointer)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2539
	returnValue = __MKSTRING(__returnValue.pointerVal);
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2540
    } else if (returnTypeSymbol == @symbol(wcharPointer)) {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2541
	returnValue = __MKU16STRING(__returnValue.pointerVal);
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2542
    } else {
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2543
	__FAIL__(@symbol(UnknownReturnType2))
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2544
    }
19931
0ea2a7e6bb41 calls without FFI
Claus Gittinger <cg@exept.de>
parents: 19860
diff changeset
  2545
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2546
getOutOfHere: ;
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2547
%}.
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2548
    failureCode notNil ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2549
	(failureCode == #UnknownReturnType or:[ failureCode == #UnknownArgumentType ]) ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2550
	    oldReturnType := returnType.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2551
	    oldArgumentTypes := argumentTypes.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2552
	    self adjustTypes.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2553
	    ((oldReturnType ~= returnType) or:[oldArgumentTypes ~= argumentTypes]) ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2554
		thisContext restart
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2555
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2556
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2557
	(failureCode == #BadArgForAsyncCall) ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2558
	    ^ self tryAgainWithAsyncSafeArguments:argumentsOrNil forCPPInstance:aReceiverOrNil
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2559
	].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2560
	(failureCode == #FFINotSupported) ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2561
	    self primitiveFailed:'FFI support missing in this build'.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2562
	].
12579
516bba5b3e57 changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents: 12504
diff changeset
  2563
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2564
	self primitiveFailed.   "see failureCode and failureInfo for details"
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2565
	^ nil
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2566
    ].
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2567
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  2568
    returnType isSymbol ifTrue:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2569
	returnValueClass notNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2570
	    self isConstReturnValue ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2571
		returnValue changeClassTo:returnValueClass.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2572
		^ returnValue
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2573
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2574
	    ^ returnValueClass fromExternalAddress:returnValue.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2575
	].
9483
3bea515ce81e *** empty log message ***
fm
parents: 9479
diff changeset
  2576
    ] ifFalse:[
19535
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2577
	returnType isCPointer ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2578
	    returnType baseType isCStruct ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2579
		stClass := Smalltalk classNamed:returnType baseType name.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2580
		stClass notNil ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2581
		    self isConstReturnValue ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2582
			returnValue changeClassTo:returnValueClass.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2583
			^ returnValue
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2584
		    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2585
		    ^ stClass fromExternalAddress:returnValue.
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2586
		].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2587
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2588
	    returnType baseType isCChar ifTrue:[
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2589
		^ returnValue stringAt:1
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2590
	    ].
6c3365fc82bc fix for mingw ffi-calls
Claus Gittinger <cg@exept.de>
parents: 19514
diff changeset
  2591
	].
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2592
    ].
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2593
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2594
    ^ returnValue
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2595
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2596
    "Created: / 01-08-2006 / 13:56:23 / cg"
19514
7605a907a2eb #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19505
diff changeset
  2597
    "Modified: / 31-03-2016 / 00:03:03 / cg"
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2598
!
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2599
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  2600
tryAgainWithAsyncSafeArguments:argumentsOrNil forCPPInstance:aReceiverOrNil
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2601
    "invoked by the call primitive, iff GC-unsave arguments where passed to the call.
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2602
     Here, allocate non-movable blocks of memory and copy the arguments into them,
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2603
     then try the call again, copy changed values back, and release the memeory."
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2604
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2605
    |saveArguments anyBadArg result originalToSaveArgMapping|
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2606
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2607
    argumentsOrNil isNil ifTrue:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2608
	^ self primitiveFailed
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2609
    ].
14506
e53548cdc24d changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents: 14412
diff changeset
  2610
    thisContext isRecursive ifTrue: [^self primitiveFailed].
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2611
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2612
    anyBadArg := false.
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2613
    originalToSaveArgMapping := IdentityDictionary new.
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2614
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2615
    saveArguments := argumentsOrNil
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2616
			collect:[:eachArg |
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2617
			    |saveArg|
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2618
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2619
			    (originalToSaveArgMapping includesKey:eachArg) ifTrue:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2620
				saveArg := originalToSaveArgMapping at:eachArg
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2621
			    ] ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2622
				eachArg isString ifTrue:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2623
				    saveArg := (ExternalBytes fromString:eachArg) register.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2624
				    anyBadArg := true.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2625
				    originalToSaveArgMapping at:eachArg put:saveArg.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2626
				] ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2627
				    eachArg isByteCollection ifTrue:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2628
					saveArg := (ExternalBytes from:eachArg) register.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2629
					originalToSaveArgMapping at:eachArg put:saveArg.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2630
					anyBadArg := true.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2631
				    ] ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2632
					saveArg := eachArg
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2633
				    ]
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2634
				].
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2635
			    ].
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2636
			    saveArg
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2637
			].
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2638
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2639
    anyBadArg ifFalse:[
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2640
	"avoid recursion..."
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2641
	^ self primitiveFailed
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2642
    ].
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2643
14659
410089913ca1 allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  2644
    result := self invokeFFIwithArguments:saveArguments forCPPInstance:aReceiverOrNil.
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2645
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2646
    "/ copy back !!
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2647
    originalToSaveArgMapping keysAndValuesDo:[:arg :saveArg |
14625
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2648
	arg isSymbol ifFalse:[
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2649
	    arg replaceFrom:1 to:(arg size) with:saveArg startingAt:1.
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2650
	].
290463096ff5 NEED_DOUBLE_ALIGN fix
Claus Gittinger <cg@exept.de>
parents: 14516
diff changeset
  2651
	saveArg free.
14037
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2652
    ].
Michael Beyl <mb@exept.de>
parents: 13782
diff changeset
  2653
    ^ result.
14506
e53548cdc24d changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents: 14412
diff changeset
  2654
e53548cdc24d changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents: 14412
diff changeset
  2655
    "Modified (format): / 06-11-2012 / 10:52:41 / anwild"
9342
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2656
! !
e548ce80ab02 virtual calls
Claus Gittinger <cg@exept.de>
parents: 9341
diff changeset
  2657
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
  2658
!ExternalLibraryFunction methodsFor:'testing'!
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
  2659
10603
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2660
isExternalLibraryFunction
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2661
    "return true, if the receiver is some kind of externalLibrary function;
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2662
     true is returned here"
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2663
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2664
    ^true
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2665
da9b7ed81caf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10514
diff changeset
  2666
    "Created: / 07-06-2007 / 10:36:40 / cg"
10481
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
  2667
! !
b3526180579f +isExternalLibraryFunction
fm
parents: 10440
diff changeset
  2668
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2669
!ExternalLibraryFunction class methodsFor:'documentation'!
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2670
19487
79d76a2de0f1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19483
diff changeset
  2671
version
79d76a2de0f1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19483
diff changeset
  2672
    ^ '$Header$'
79d76a2de0f1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19483
diff changeset
  2673
!
79d76a2de0f1 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19483
diff changeset
  2674
13412
9a5f99d66cd9 Jan's changes
vrany
parents: 13337
diff changeset
  2675
version_CVS
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  2676
    ^ '$Header$'
12436
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
  2677
!
92a968c9ca92 changed:
Claus Gittinger <cg@exept.de>
parents: 11586
diff changeset
  2678
13412
9a5f99d66cd9 Jan's changes
vrany
parents: 13337
diff changeset
  2679
version_SVN
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  2680
    ^ '$ Id: ExternalLibraryFunction.st 10643 2011-06-08 21:53:07Z vranyj1  $'
8533
9065c547ea75 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2681
! !
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2682
19311
6f1d1ea6dba8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  2683
9463
864880338d7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9460
diff changeset
  2684
ExternalLibraryFunction initialize!