878 "call the function with no arguments" |
878 "call the function with no arguments" |
879 |
879 |
880 self hasCode ifFalse:[ |
880 self hasCode ifFalse:[ |
881 self prepareInvoke. |
881 self prepareInvoke. |
882 ]. |
882 ]. |
883 ^ self invokeFFIwithArguments:nil forCPPInstance:nil |
883 ^ self invokeFFIwithArguments:nil forInstance:nil |
884 |
884 |
885 "Modified (comment): / 04-03-2019 / 09:41:20 / Claus Gittinger" |
885 "Modified (comment): / 04-03-2019 / 09:41:20 / Claus Gittinger" |
886 ! |
886 ! |
887 |
887 |
888 invokeCPPVirtualOn:anInstance |
888 invokeCPPVirtualOn:anInstance |
889 "call a CPP virtual function with no arguments" |
889 "call a CPP virtual function with no arguments" |
890 |
890 |
891 self hasCode ifFalse:[ |
891 self hasCode ifFalse:[ |
892 self prepareInvoke. |
892 self prepareInvoke. |
893 ]. |
893 ]. |
894 ^ self invokeFFIwithArguments:nil forCPPInstance:anInstance |
894 ^ self invokeFFIwithArguments:nil forInstance:anInstance |
895 |
895 |
896 "Modified (comment): / 04-03-2019 / 09:39:27 / Claus Gittinger" |
896 "Modified (comment): / 04-03-2019 / 09:39:27 / Claus Gittinger" |
897 ! |
897 ! |
898 |
898 |
899 invokeCPPVirtualOn:anInstance with:arg |
899 invokeCPPVirtualOn:anInstance with:arg |
954 self hasCode ifFalse:[ |
954 self hasCode ifFalse:[ |
955 self prepareInvoke. |
955 self prepareInvoke. |
956 ]. |
956 ]. |
957 ^ self |
957 ^ self |
958 invokeFFIwithArguments:args |
958 invokeFFIwithArguments:args |
959 forCPPInstance:anInstance |
959 forInstance:anInstance |
960 |
960 |
961 "Modified (comment): / 04-03-2019 / 09:39:57 / Claus Gittinger" |
961 "Modified (comment): / 04-03-2019 / 09:39:57 / Claus Gittinger" |
962 ! |
962 ! |
963 |
963 |
964 invokeObjCOn:anInstance |
964 invokeObjCOn:anInstance |
965 "call an ObjC method with no arguments" |
965 "call an ObjC method with no arguments" |
966 |
966 |
967 self hasCode ifFalse:[ |
967 self hasCode ifFalse:[ |
968 self prepareObjCInvoke. |
968 self prepareObjCInvoke. |
969 ]. |
969 ]. |
970 ^ self invokeFFIwithArguments:nil forCPPInstance:anInstance |
970 ^ self invokeFFIwithArguments:nil forInstance:anInstance |
971 |
971 |
972 "Created: / 04-03-2019 / 09:12:12 / Claus Gittinger" |
972 "Created: / 04-03-2019 / 09:12:12 / Claus Gittinger" |
973 ! |
973 ! |
974 |
974 |
975 invokeObjCOn:anInstance withArguments:args |
975 invokeObjCOn:anInstance withArguments:args |
976 "call an ObjC method with up to maxArgs (15) arguments" |
976 "call an ObjC method with up to maxArgs (15) arguments" |
977 |
977 |
978 self hasCode ifFalse:[ |
978 self hasCode ifFalse:[ |
979 self prepareObjCInvoke. |
979 self prepareObjCInvoke. |
980 ]. |
980 ]. |
981 ^ self invokeFFIwithArguments:args forCPPInstance:anInstance |
981 ^ self invokeFFIwithArguments:args forInstance:anInstance |
982 |
982 |
983 "Created: / 04-03-2019 / 09:39:03 / Claus Gittinger" |
983 "Created: / 04-03-2019 / 09:39:03 / Claus Gittinger" |
984 ! |
984 ! |
985 |
985 |
986 invokeWith:arg |
986 invokeWith:arg |
987 "call the function with 1 argument" |
987 "call the function with 1 argument" |
988 |
988 |
989 self hasCode ifFalse:[ |
989 self hasCode ifFalse:[ |
990 self prepareInvoke. |
990 self prepareInvoke. |
991 ]. |
991 ]. |
992 ^ self invokeFFIwithArguments:(Array with:arg) forCPPInstance:nil |
992 ^ self invokeFFIwithArguments:(Array with:arg) forInstance:nil |
993 |
993 |
994 "Modified (comment): / 04-03-2019 / 09:41:14 / Claus Gittinger" |
994 "Modified (comment): / 04-03-2019 / 09:41:14 / Claus Gittinger" |
995 ! |
995 ! |
996 |
996 |
997 invokeWith:arg1 with:arg2 |
997 invokeWith:arg1 with:arg2 |
998 "call the function with 2 arguments" |
998 "call the function with 2 arguments" |
999 |
999 |
1000 self hasCode ifFalse:[ |
1000 self hasCode ifFalse:[ |
1001 self prepareInvoke. |
1001 self prepareInvoke. |
1002 ]. |
1002 ]. |
1003 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2) forCPPInstance:nil |
1003 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2) forInstance:nil |
1004 |
1004 |
1005 "Modified (comment): / 04-03-2019 / 09:41:07 / Claus Gittinger" |
1005 "Modified (comment): / 04-03-2019 / 09:41:07 / Claus Gittinger" |
1006 ! |
1006 ! |
1007 |
1007 |
1008 invokeWith:arg1 with:arg2 with:arg3 |
1008 invokeWith:arg1 with:arg2 with:arg3 |
1009 "call the function with 3 arguments" |
1009 "call the function with 3 arguments" |
1010 |
1010 |
1011 self hasCode ifFalse:[ |
1011 self hasCode ifFalse:[ |
1012 self prepareInvoke. |
1012 self prepareInvoke. |
1013 ]. |
1013 ]. |
1014 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3) forCPPInstance:nil |
1014 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3) forInstance:nil |
1015 |
1015 |
1016 "Modified (comment): / 04-03-2019 / 09:41:01 / Claus Gittinger" |
1016 "Modified (comment): / 04-03-2019 / 09:41:01 / Claus Gittinger" |
1017 ! |
1017 ! |
1018 |
1018 |
1019 invokeWith:arg1 with:arg2 with:arg3 with:arg4 |
1019 invokeWith:arg1 with:arg2 with:arg3 with:arg4 |
1020 "call the function with 4 arguments" |
1020 "call the function with 4 arguments" |
1021 |
1021 |
1022 self hasCode ifFalse:[ |
1022 self hasCode ifFalse:[ |
1023 self prepareInvoke. |
1023 self prepareInvoke. |
1024 ]. |
1024 ]. |
1025 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) forCPPInstance:nil |
1025 ^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) forInstance:nil |
1026 |
1026 |
1027 "Modified (comment): / 04-03-2019 / 09:40:56 / Claus Gittinger" |
1027 "Modified (comment): / 04-03-2019 / 09:40:56 / Claus Gittinger" |
1028 ! |
1028 ! |
1029 |
1029 |
1030 invokeWithArguments:argArray |
1030 invokeWithArguments:argArray |
1031 "call the function with up to maxArgs (15) arguments" |
1031 "call the function with up to maxArgs (15) arguments" |
1032 |
1032 |
1033 self hasCode ifFalse:[ |
1033 self hasCode ifFalse:[ |
1034 self prepareInvoke. |
1034 self prepareInvoke. |
1035 ]. |
1035 ]. |
1036 ^ self invokeFFIwithArguments:argArray forCPPInstance:nil |
1036 ^ self invokeFFIwithArguments:argArray forInstance:nil |
1037 |
1037 |
1038 "Modified: / 01-08-2006 / 16:04:08 / cg" |
1038 "Modified: / 01-08-2006 / 16:04:08 / cg" |
1039 "Modified (comment): / 04-03-2019 / 09:40:48 / Claus Gittinger" |
1039 "Modified (comment): / 04-03-2019 / 09:40:48 / Claus Gittinger" |
1040 ! ! |
1040 ! ! |
1041 |
1041 |
1300 ! ! |
1300 ! ! |
1301 |
1301 |
1302 !ExternalLibraryFunction methodsFor:'private-invoking'! |
1302 !ExternalLibraryFunction methodsFor:'private-invoking'! |
1303 |
1303 |
1304 invokeCPPVirtualFFIOn:instance withArguments:arguments |
1304 invokeCPPVirtualFFIOn:instance withArguments:arguments |
1305 ^ self invokeFFIwithArguments:arguments forCPPInstance:instance |
1305 ^ self invokeFFIwithArguments:arguments forInstance:instance |
1306 |
1306 |
1307 "Modified: / 01-08-2006 / 13:55:30 / cg" |
1307 "Modified: / 01-08-2006 / 13:55:30 / cg" |
1308 ! |
1308 ! |
1309 |
1309 |
1310 invokeFFIWithArguments:arguments |
1310 invokeFFIWithArguments:arguments |
1311 ^ self invokeFFIwithArguments:arguments forCPPInstance:nil |
1311 ^ self invokeFFIwithArguments:arguments forInstance:nil |
1312 |
1312 |
1313 "Modified: / 01-08-2006 / 13:55:35 / cg" |
1313 "Modified: / 01-08-2006 / 13:55:35 / cg" |
1314 ! |
1314 ! |
1315 |
1315 |
1316 invokeFFIwithArguments:argumentsOrNilIn forCPPInstance:aReceiverOrNil |
1316 invokeFFIwithArguments:argumentsOrNilIn forInstance:aReceiverOrNil |
1317 "basic invoke mechanism. Calls the function represented by the receiver with argumentsOrNil. |
1317 "basic invoke mechanism. Calls the function represented by the receiver with argumentsOrNil. |
1318 For cplusplus, aReceiverOrNil is required to be an externalStructure like object; |
1318 For cplusplus, aReceiverOrNil is required to be an externalStructure like object; |
1319 for objectiveC, it must be an ObjectiveC object" |
1319 for objectiveC, it must be an ObjectiveC object" |
1320 |
1320 |
1321 |argTypeSymbols returnTypeSymbol failureCode failureArgNr failureInfo returnValue stClass vtOffset |
1321 |argTypeSymbols returnTypeSymbol failureCode failureArgNr failureInfo returnValue stClass vtOffset |
2919 "Modified: / 15-05-2017 / 19:48:52 / mawalch" |
2919 "Modified: / 15-05-2017 / 19:48:52 / mawalch" |
2920 "Modified: / 01-08-2017 / 14:03:52 / cg" |
2920 "Modified: / 01-08-2017 / 14:03:52 / cg" |
2921 "Modified: / 01-03-2019 / 15:40:14 / Claus Gittinger" |
2921 "Modified: / 01-03-2019 / 15:40:14 / Claus Gittinger" |
2922 ! |
2922 ! |
2923 |
2923 |
2924 tryAgainWithAsyncSafeArguments:argumentsOrNil forCPPInstance:aReceiverOrNil |
2924 tryAgainWithAsyncSafeArguments:argumentsOrNil forInstance:aReceiverOrNil |
2925 "invoked by the call primitive, iff GC-unsave arguments where passed to the call. |
2925 "invoked by the call primitive, iff GC-unsave arguments where passed to the call. |
2926 Here, allocate non-movable blocks of memory and copy the arguments into them, |
2926 Here, allocate non-movable blocks of memory and copy the arguments into them, |
2927 then try the call again, copy changed values back, and release the memeory." |
2927 then try the call again, copy changed values back, and release the memeory." |
2928 |
2928 |
2929 |saveArguments anyBadArg result originalToSaveArgMapping| |
2929 |saveArguments anyBadArg result originalToSaveArgMapping| |