]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/builder/alien/alien-docs.factor
VM: always use undecorated names when loading ffi functions
[factor.git] / basis / compiler / cfg / builder / alien / alien-docs.factor
1 USING: alien alien.libraries compiler.cfg.builder help.markup
2 help.syntax literals make multiline sequences stack-checker.alien
3 strings ;
4 IN: compiler.cfg.builder.alien
5
6 <<
7 STRING: ex-caller-return
8 USING: compiler.cfg.builder.alien make prettyprint ;
9 [
10     T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } } ,
11     T{ alien-invoke-params { return pointer: void } }  caller-return
12 ] { } make  .
13 {
14     T{ ##alien-invoke { reg-outputs { { 1 int-rep RAX } } } }
15     T{ ##box-alien { dst 116 } { src 1 } { temp 115 } }
16 }
17 ;
18 >>
19
20 HELP: caller-linkage
21 { $values
22   { "params" alien-node-params }
23   { "symbol" string }
24   { "dll" dll }
25 }
26 { $description "This word gets the name and library to use when linking to a function in a dynamically loaded dll. It is assumed that the library exports the undecorated name, regardless of calling convention." } ;
27
28 HELP: caller-return
29 { $values { "params" alien-node-params } }
30 { $description "If the last alien call returns a value, then this word will emit an instruction to the current sequence being constructed by " { $link make } " that boxes it." }
31 { $examples { $unchecked-example $[ ex-caller-return ] } } ;
32
33 HELP: check-dlsym
34 { $values { "symbol" string } { "library" library } }
35 { $description "Checks that a symbol with the given name exists in the given library. Throws an error if not." } ;
36
37 HELP: unbox-parameters
38 { $values { "parameters" sequence } { "vregs" sequence } { "reps" sequence } }
39 { $description "Unboxes a sequence of parameters to send to an ffi function." } ;
40
41 ARTICLE: "compiler.cfg.builder.alien"
42 "CFG node emitter for alien nodes"
43 "The " { $vocab-link "compiler.cfg.builder.alien" } " vocab implements " { $link emit-node } " methods for alien nodes." ;
44
45 ABOUT: "compiler.cfg.builder.alien"