GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [[ Bug 20411 ]] Correct call to objc_msgSend · livecode/livecode@37ec97e

This repository was archived by the owner on Aug 31, 2021. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs/notes
    • bugfix-20411.md
  • libscript/src
    • script-execute.cpp
    • script-instance.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/notes/bugfix-20411.md‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix crash when using Obj-C FFI on iOS
Collapse file

‎libscript/src/script-execute.cpp‎

Copy file name to clipboardExpand all lines: libscript/src/script-execute.cpp
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class MCScriptForeignInvocation
268268
/* There are different variants of objc_msgSend we need to use
269269
* depending on architecture and return type:
270270
* struct return
271-
* all: _stret
271+
* all but arm64: _stret
272272
* float return
273273
* arm: no difference
274274
* i386: _fpret
@@ -289,7 +289,9 @@ class MCScriptForeignInvocation
289289

290290
ffi_cif *t_cif = (ffi_cif *)p_handler->objc.function_cif;
291291
void (*t_objc_msgSend)() = nullptr;
292-
#if defined(__ARM__)
292+
#if defined(__ARM64__)
293+
t_objc_msgSend = (void(*)())objc_msgSend;
294+
#elif defined(__ARM__)
293295
if (t_cif->rtype->type == FFI_TYPE_STRUCT)
294296
t_objc_msgSend = (void(*)())objc_msgSend_stret;
295297
else
@@ -310,12 +312,14 @@ class MCScriptForeignInvocation
310312
t_objc_msgSend = (void(*)())objc_msgSend_fpret;
311313
else
312314
t_objc_msgSend = (void(*)())objc_msgSend;
315+
#else
316+
#error unknown architecture for objc_msgSend
313317
#endif
314318
/* We must use a wrapper function written in an obj-c++ source file so that
315319
* we can capture any obj-c exceptions. */
316320
extern bool MCScriptCallObjCCatchingErrors(ffi_cif*, void (*)(), void *, void **);
317321
return MCScriptCallObjCCatchingErrors(t_cif,
318-
(void(*)())objc_msgSend,
322+
t_objc_msgSend,
319323
p_result_slot_ptr,
320324
t_objc_values);
321325
#else
Collapse file

‎libscript/src/script-instance.cpp‎

Copy file name to clipboardExpand all lines: libscript/src/script-instance.cpp
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,9 +1147,8 @@ __MCScriptResolveForeignFunctionBindingForObjC(MCScriptInstanceRef p_instance,
11471147
* make. */
11481148
if (t_valid)
11491149
{
1150-
if (ffi_prep_cif_var(t_cif,
1150+
if (ffi_prep_cif(t_cif,
11511151
FFI_DEFAULT_ABI,
1152-
2,
11531152
t_arg_count,
11541153
t_cif_return_type,
11551154
t_cif_arg_types) != FFI_OK)

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.