Serving the Quantitative Finance Community

 
User avatar
Polter
Topic Author
Posts: 1
Joined: April 29th, 2008, 4:55 pm

Foreign Function Interface (FFI)

October 27th, 2011, 7:43 pm

This is a thread devoted solely to the foreign function interface (FFI) discussion -- achieving the interoperability across the various programming languages and with various environments (Excel, the Web).Feel free to discuss any FFI-related issues (language projections, bindings, etc.).Background / references / moved-from threads:- ForeignFunctionInterface- SWIG, etc. - http://www.wilmott.com/messageview.cfm? ... did=86928- MATLAB interface - http://www.wilmott.com/messageview.cfm? ... adid=87098 (the discussion there on achieving MATLAB-idiomatic style is related to the language projections approach -- see below)
Last edited by Polter on October 26th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
Polter
Topic Author
Posts: 1
Joined: April 29th, 2008, 4:55 pm

Foreign Function Interface (FFI)

October 27th, 2011, 7:45 pm

Elaborating on the FFI -- ideally, this should not mean merely bindings, but rather language projections -- they should feel "native" to the users of the given language consuming the given FFI.An example implementation of what I mean is that of WinRT:http://stackoverflow.com/questions/7432 ... QuoteWinRT ProjectionsWhat we call "bindings" Microsoft now calls "projections". Projections are the process of exposing APIs to three environments: Native (C and C++), HTML/Javascript and .NET.If you author a component in C++ or a .NET language, its API will be stored in a WinMD file and you will be able to consume it from all three environments (Native, JavaScript and .NET).Even in C++ you are not exposed to COM. The use of COM is hidden behind the C++ projection tools. You use what looks and feels like a C++ object oriented API.To support the various constructs of WinRT, the underlying platform defines a basic set of types and their mappings to various environment. In particular, collection objects in WinRT are mapped to constructs that are native to each environment.I don't feel strongly about any of the implementation details (metadata files, etc.) in this early design stage -- the emphasis is on the last part (in bold).A good video on the language projections in case of WinRT (also talks about the broad architectural & design issues, might be useful to see if there are any analogies that may apply):http://channel9.msdn.com/Events/BUILD/B ... TQuote"The Windows Runtime (WinRT) is a key piece of technology used by all Metro style apps in Windows. What actually is the Windows Runtime though? This session explores this key question by digging into the concepts of language projections, the WinRT type system and advanced API patterns included in the Windows Runtime. Learn how Windows uses interface patterns combined with language projection to present modern concepts in a natural and familiar way to each programming language."
Last edited by Polter on October 27th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
Alan
Posts: 3050
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Foreign Function Interface (FFI)

October 27th, 2011, 11:50 pm

I ran across this the other day, although I haven't installed it:Quantlib for MathematicaThe thing that gave me pause was the instruction to unzip a big file into a hidden (system) folder.Is that at all dangerous? Otherwise, it looked very easy and made QL look like ordinaryMathematica stuff. Maybe QFCL can do something similar.
 
User avatar
Polter
Topic Author
Posts: 1
Joined: April 29th, 2008, 4:55 pm

Foreign Function Interface (FFI)

December 20th, 2011, 7:29 pm

At some point, this could come in handy as far as the C++/C# part is concerned:http://tirania.org/blog/archive/2011/De ... /cxxi-mono