Skip to content

Commit

Permalink
node-ffi: fix Callback interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike H. Hawley committed Feb 21, 2014
1 parent 239e303 commit 594302f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions node-ffi/node-ffi-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import TArray = require('ref-array');
func(-5);
func.async(-5, function(err: any, res: any) {});
}
{
var funcPtr = ffi.Callback('int', [ 'int' ], Math.abs);
var func = ffi.ForeignFunction(funcPtr, 'int', [ 'int' ]);
}
{
var printfPointer = ffi.DynamicLibrary().get('printf');
var printfGen = ffi.VariadicForeignFunction(printfPointer, 'void', [ 'string' ]);
Expand Down
12 changes: 6 additions & 6 deletions node-ffi/node-ffi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ declare module "ffi" {
* accept C callback functions.
*/
export var Callback: {
new (retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer;
new (retType: any, argTypes: any[], fn: Function): NodeBuffer;
(retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer;
(retType: any, argTypes: any[], fn: Function): NodeBuffer;
new (retType: any, argTypes: any[], abi: number, fn: any): NodeBuffer;
new (retType: any, argTypes: any[], fn: any): NodeBuffer;
(retType: any, argTypes: any[], abi: number, fn: any): NodeBuffer;
(retType: any, argTypes: any[], fn: any): NodeBuffer;
}

export var ffiType: {
Expand All @@ -154,8 +154,8 @@ declare module "ffi" {
FFI_TYPE: StructType;
}

export var CIF: Function;
export var CIF_var: Function;
export var CIF: (retType: any, types: any[], abi?: any) => NodeBuffer
export var CIF_var: (retType: any, types: any[], numFixedArgs: number, abi?: any) => NodeBuffer;
export var HAS_OBJC: boolean;
export var FFI_TYPES: {[key: string]: NodeBuffer};
export var FFI_OK: number;
Expand Down

0 comments on commit 594302f

Please sign in to comment.