Opened 8 years ago

Last modified 7 years ago

#1592 new proposed-project

C++ -> Haskell FFI Generator using SWIG

Reported by: Ian Duncan Owned by:
Priority: good Keywords: c++
Cc: Difficulty: 1 person Summer
Mentor: not-accepted Topic: Bindings


I'd like to head up the implementation of a basic SWIG module that will properly generate appropriate C wrappers and hsc files that implement C++ classes, inheritance, and method calls appropriately. This would include generating type classes that emulate upcasting and public methods, proper handling of typedefs to correspond in Haskell, generating accessors for public class members, and creating equivalent constant variables in the Haskell code, and finally converting enums into data types.


Change History (3)

comment:1 Changed 8 years ago by Johan Tibell

I actually think this is quite a nice proposal. It'd allow companies with large C++ code bases to use Haskell as they can reuse their own investment.

I suppose the majority of the work would be to actually extend SWIG rather than writing a lot of Haskell.

comment:2 Changed 8 years ago by Johan Tibell

Priority: not yet ratedgood

Note that the student need to be familiar with both SWIG (preferably having done some work in the SWIG code base already) and Haskell (as we don't want ugly generated Haskell code).

comment:3 Changed 7 years ago by avaitla

This is a cool idea, and really useful project. Also, one possibility is rather than create a C++ -> Haskell Swig interface, working on the C++ -> C swig interface, and then using the existing Haskell tools (c2hs, hsc2hs, greencard, etc) which are already stable tools to generate C bindings. If anyone wants to take this route, you can apply at the Swig GSOC, where this is one of the project ideas which seems like something that will definitely be picked up.

Note: See TracTickets for help on using tickets.