Ticket #1592 (new proposed-project)

Opened 2 years ago

Last modified 14 months ago

C++ -> Haskell FFI Generator using SWIG

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

Description

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.

Thoughts?

Change History

Changed 2 years ago by tibbe

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.

Changed 2 years ago by tibbe

  • priority changed from not yet rated to good

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).

Changed 14 months 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.