From 89130bd64f0f5406f628082551acf2a0c94da5f7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 17 Feb 2021 11:09:54 -0700 Subject: [PATCH] unbreak cross build --- racket/src/cs/rumble/foreign.ss | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/racket/src/cs/rumble/foreign.ss b/racket/src/cs/rumble/foreign.ss index 98b93e23cc..9e6ba98e7e 100644 --- a/racket/src/cs/rumble/foreign.ss +++ b/racket/src/cs/rumble/foreign.ss @@ -2004,12 +2004,16 @@ (define call-with-c-return (let ([call (lambda (thunk) (thunk))]) (define-ftype ptr->ptr (function (ptr) ptr)) - (let ([fptr (make-ftype-pointer ptr->ptr call)]) - (let ([v (ftype-ref ptr->ptr () fptr)]) - (unlock-object - (foreign-callable-code-object - (ftype-pointer-address fptr))) - v)))) + (cond + [(not (eq? (machine-type) (#%$target-machine))) + (lambda (thunk) (#%error 'call-with-c-return "cannot use while cross-compiling"))] + [else + (let ([fptr (make-ftype-pointer ptr->ptr call)]) + (let ([v (ftype-ref ptr->ptr () fptr)]) + (unlock-object + (foreign-callable-code-object + (ftype-pointer-address fptr))) + v))]))) ;; ----------------------------------------