pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                          abi: Abi, fty: Ty<'tcx>,
                                          name: &str) -> ValueRef {
    debug!("register_foreign_item_fn(abi={:?}, \
            ty={:?}, \
            name={})",
           abi,
           fty,
           name);

    let cc = llvm_calling_convention(ccx, abi);

    // Register the function as a C extern fn
    let tys = foreign_types_for_fn_ty(ccx, fty);

    // Make sure the calling convention is right for variadic functions
    // (should've been caught if not in typeck)
    if tys.fn_sig.variadic {
        assert!(cc == llvm::CCallConv);
    }

    // Create the LLVM value for the C extern fn
    let llfn_ty = lltype_for_fn_from_foreign_types(ccx, &tys);

    let llfn = get_extern_fn(ccx, &mut *ccx.externs().borrow_mut(), name, cc, llfn_ty, fty);
    add_argument_attributes(&tys, llfn);
    llfn
}
/// Registers a foreign function found in a library. Just adds a LLVM global.
Registers a foreign function found in a library. Just adds a LLVM global.
Registers a foreign function found in a library . Just adds a LLVM global .
pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                          abi: Abi, fty: Ty<'tcx>,
                                          name: &str) -> ValueRef {
    debug!("register_foreign_item_fn(abi={:?}, \
            ty={:?}, \
            name={})",
           abi,
           fty,
           name);
    let cc = llvm_calling_convention(ccx, abi);
    // Register the function as a C extern fn
    let tys = foreign_types_for_fn_ty(ccx, fty);
    // Make sure the calling convention is right for variadic functions
    // (should've been caught if not in typeck)
    if tys.fn_sig.variadic {
        assert!(cc == llvm::CCallConv);
    }
    // Create the LLVM value for the C extern fn
    let llfn_ty = lltype_for_fn_from_foreign_types(ccx, &tys);
    let llfn = get_extern_fn(ccx, &mut *ccx.externs().borrow_mut(), name, cc, llfn_ty, fty);
    add_argument_attributes(&tys, llfn);
    llfn
}
pub fn register_foreign_item_fn < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > , abi : Abi , fty : Ty < ' tcx > , name : & str ) -> ValueRef { debug ! ( " \
 \
 " abi fty name ) ; let cc = llvm_calling_convention ( ccx , abi ) ; // Register the function as a C extern fn let tys = foreign_types_for_fn_ty ( ccx , fty ) ; // Make sure the calling convention is right for variadic functions // (should've been caught if not in typeck) if tys . fn_sig . variadic { assert ! ( cc llvm CCallConv ) ; } // Create the LLVM value for the C extern fn let llfn_ty = lltype_for_fn_from_foreign_types ( ccx , & tys ) ; let llfn = get_extern_fn ( ccx , & mut * ccx . externs ( ) . borrow_mut ( ) , name , cc , llfn_ty , fty ) ; add_argument_attributes ( & tys , llfn ) ; llfn }
Registers a foreign function found in a library.
Registers a foreign function found in a library .
ccx
&CrateContext<'a, 'tcx>
abi
Abi
fty
Ty<'tcx>
name
&str
ccx
&CrateContext<'a, 'tcx>
abi
Abi
fty
Ty<'tcx>
name
&str