summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRongcui Dong <rongcuid@outlook.com>2024-05-11 17:56:00 -0400
committerChristophe Rhodes <csr21@cantab.net>2024-05-20 17:25:37 +0100
commite2b4c1018041a23e38b0d504145b30d5928472d4 (patch)
tree27c04706f1a59b84d8f985386c0462dc92f15353
parent5cd67d8c5df7b11dafc4c10a7ee0a6751c28da10 (diff)
Bugfix #313202 milestone 1.
- Raise error when attempting to define alien routines that pass/return struct by value
-rw-r--r--src/code/c-call.lisp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/code/c-call.lisp b/src/code/c-call.lisp
index d5a114cf7..ddc9a158d 100644
--- a/src/code/c-call.lisp
+++ b/src/code/c-call.lisp
@@ -135,3 +135,14 @@
(simple-string
(string-to-c-string ,value
(c-string-external-format ,type)))))))
+;;;; Struct Support (or the lack thereof)
+;; NOTE: RECORD follows the hierarchy of RECORD -> MEM-BLOCK -> ALIEN-VALUE -> SAP.
+;; All platforms have passing SAP defined, which causes passing record by value
+;; to silently corrupt.
+;; -- Rongcui
+(define-alien-type-method (record :arg-tn) (type state)
+ (declare (ignore type state))
+ (error "Passing structs by value is unsupported on this platform."))
+(define-alien-type-method (record :result-tn) (type state)
+ (declare (ignore type state))
+ (error "Returning structs by value is unsupported on this platform."))