diff --git a/compiler.scm b/compiler.scm
index a3fa620..629881f 100644
|
a
|
b
|
|
| 1140 | 1140 | ((##core#foreign-callback-wrapper) |
| 1141 | 1141 | (let-values ([(args lam) (split-at (cdr x) 4)]) |
| 1142 | 1142 | (let* ([lam (car lam)] |
| 1143 | | [name (cadr (first args))] |
| | 1143 | [raw-c-name (cadr (first args))] |
| | 1144 | [name (##sys#alias-global-hook raw-c-name #t dest)] |
| 1144 | 1145 | [rtype (cadr (third args))] |
| 1145 | 1146 | [atypes (cadr (fourth args))] |
| 1146 | 1147 | [vars (second lam)] ) |
| 1147 | | (if (valid-c-identifier? name) |
| | 1148 | (if (valid-c-identifier? raw-c-name) |
| 1148 | 1149 | (set! callback-names (cons name callback-names)) |
| 1149 | 1150 | (quit "name `~S' of external definition is not a valid C identifier" |
| 1150 | | name) ) |
| | 1151 | raw-c-name) ) |
| 1151 | 1152 | (when (or (not (proper-list? vars)) |
| 1152 | 1153 | (not (proper-list? atypes)) |
| 1153 | 1154 | (not (= (length vars) (length atypes))) ) |
diff --git a/tests/compiler-tests.scm b/tests/compiler-tests.scm
index f4feb01..78bcb0e 100644
|
a
|
b
|
|
| 137 | 137 | ((foreign-safe-lambda* void () |
| 138 | 138 | "print_foo(\"bar\");")) |
| 139 | 139 | |
| | 140 | ;; Unused arguments in foreign callback wrappers are not optimized away |
| | 141 | (module bla (foo) |
| | 142 | |
| | 143 | (import chicken scheme foreign) |
| | 144 | |
| | 145 | (define-external |
| | 146 | (blabla (int a) (c-string b) (int c) (int d) (c-string e) (int f)) |
| | 147 | int |
| | 148 | f) |
| | 149 | |
| | 150 | (define (foo) ((foreign-safe-lambda* int () "C_return(blabla(1, \"2\", 3, 4, \"5\", 6));"))) |
| | 151 | ) |
| | 152 | |
| | 153 | (import bla) |
| | 154 | (assert (= (foo) 6)) |
| 140 | 155 | |
| 141 | 156 | ;;; compiler-syntax for map/for-each must be careful when the |
| 142 | 157 | ; operator may have side-effects (currently only lambda exprs and symbols |