Title of article :
An adaptor for C++ callbacks with C and Fortran libraries Original Research Article
Author/Authors :
J. Broeckhove، نويسنده , , K. Vanmechelen، نويسنده ,
Issue Information :
ماهنامه با شماره پیاپی سال 2013
Abstract :
Object-oriented programming using C++ is increasingly being adopted in the development of scientific codes. A recurrent issue in this regard is the interaction of newly developed codes with existing legacy libraries written in C or Fortran. Often, one needs to pass raw function pointers to such libraries’ procedures for callback purposes. This is problematic as it conflicts with one of the cornerstones of object-oriented programming: the association of functions and data through objects. Currently ad hoc approaches are used to deal with this issue, but these are error-prone and lack reusability. We present a generic adaptor that is able to wrap any callable C++ entity and provide a raw function pointer that is compatible with C or Fortran library routines. This allows for an object-oriented style of programming, while interfacing with legacy libraries in a straightforward manner.
Keywords :
C++ callbacks , C libraries , Fortran libraries , C++ template programming
Journal title :
Computer Physics Communications
Journal title :
Computer Physics Communications