|
143 | 143 | :c-name ,(cgen-safe-name-friendly (x->string name)) |
144 | 144 | :arg-types (map %resolve-typespec ,arg-types-expr) |
145 | 145 | :return-type (%resolve-typespec ,rettype-expr)))])) |
| 146 | + ;; cfn-specs is ((name . cfn-expr) ...), where name is a symbol |
| 147 | + ;; name of cfn, and cfn-expr is (make <foreivn-c-function> ...) |
| 148 | + ;; constructed above. The subsystem macro should rearrange |
| 149 | + ;; cfn-specs so that cfn-expr is evaluated in proper context. |
146 | 150 | (let* ([ordered-cfns (reverse cfns)] |
147 | | - [cfn-names (map cadr ordered-cfns)] |
148 | | - [cfn-list-expr (quasirename r |
149 | | - `(list ,@(map make-cfn-expr ordered-cfns)))]) |
| 151 | + [cfn-specs (map (^[cfn] |
| 152 | + (cons (cadr cfn) ; name |
| 153 | + (make-cfn-expr cfn))) ;expr |
| 154 | + ordered-cfns)]) |
150 | 155 | (ecase subsystem |
151 | 156 | [(:stubgen) |
152 | 157 | (quasirename r |
153 | | - `(with-stubgen-ffi ,dlo-expr ,options ,cfn-list-expr ,forms))] |
| 158 | + `(with-stubgen-ffi ,dlo-expr ,options ,cfn-specs ,forms))] |
154 | 159 | [(:native) |
155 | 160 | (quasirename r |
156 | | - `(with-native-ffi ,dlo-expr ,options ,cfn-list-expr ,cfn-names ,forms))] |
| 161 | + `(with-native-ffi ,dlo-expr ,options ,cfn-specs ,forms))] |
157 | 162 | ))])))) |
0 commit comments