Advertisement

Using C++ Functors with Legacy C Libraries

  • Jan Broeckhove
  • Kurt Vanmechelen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3046)

Abstract

The use of functors or function objects in the object oriented programming paradigm has proven to be useful in the design of scientific applications that need to tie functions and their execution context. However, a recurrent problem when using functors is their interaction with the callback mechanism of legacy C libraries. We review some of the solutions to this problem and present the design of a generic adapter that associates a C function pointer with function objects. This makes it possible to use an object-oriented style of programming and still interface with C libraries in a straightforward manner.

Keywords

Object Instance Argument Type Call Operator Functor Object Member Function 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Stroustrup, B.: The C++ programming language. Addison-Wesley, Reading (1997)Google Scholar
  2. 2.
    Barton, J., Nackman, L.: Scientific and engineering C++. Addison-Wesley, Reading (1994)Google Scholar
  3. 3.
    Hickey, R.: Callbacks in C++ Using Template Functors. C++ Report 7(2), 42–50 (1995)Google Scholar
  4. 4.
    Jakubic, P.: Callback Implementations in C++. In: 23rd Technology of Object- Oriented Languages (TOOLS23), Santa Barbara, CA, July 28-August 1, pp. 377–406. IEEE Computer Society Press, Los Alamitos (1997)Google Scholar
  5. 5.
    Ellis, M., Stroustrup, B.: The Annotated C++ Reference. Addison-Wesley, Reading (1990)Google Scholar
  6. 6.
    Haendel, L.: The function pointer tutorials, http://www.function-pointer.org
  7. 7.
    Mensonides, P.: The Boost preprocessor library, http://www.boost.org/libs/
  8. 8.
    Meyers, N.: Traits: A New and Useful Template Technique. C++ Report 7(5), 32–35 (1995)MathSciNetGoogle Scholar
  9. 9.
    Alexandrescu, A.: Modern C++ Design. Addison-Wesley, Reading (2001)Google Scholar
  10. 10.
    Vandevoorde, D., Josuttis, N.: C++ templates. Pearson Education, London (2003)Google Scholar
  11. 11.
    Interop Systems Windows Services for UNIX, http://www.interix.com

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Jan Broeckhove
    • 1
  • Kurt Vanmechelen
    • 1
  1. 1.University of AntwerpAntwerpBelgium

Personalised recommendations