Title
|
|
|
|
An adaptor for C++ callbacks with C and Fortran libraries
|
|
Author
|
|
|
|
|
|
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. |
|
|
Language
|
|
|
|
English
|
|
Source (journal)
|
|
|
|
Computer physics communications. - Amsterdam
|
|
Publication
|
|
|
|
Amsterdam
:
2013
|
|
ISSN
|
|
|
|
0010-4655
|
|
DOI
|
|
|
|
10.1016/J.CPC.2012.10.016
|
|
Volume/pages
|
|
|
|
184
:3
(2013)
, p. 824-832
|
|
ISI
|
|
|
|
000315125500038
|
|
Full text (Publisher's DOI)
|
|
|
|
|
|
Full text (publisher's version - intranet only)
|
|
|
|
|
|