Skip to main content

Combining Python with Fortran, C, and C++

  • Chapter
  • 2192 Accesses

Part of the book series: Texts in Computational Science and Engineering ((TCSE,volume 3))

Abstract

Most languages offer the possibility to call code written in other languages, but in Python this is a particularly simple and smooth process. One reason is that Python was initially designed for being integrated with C and extended with new C code. The support for C implicitly provides support for closely related languages like Fortran and C++. Another reason is that tools, such as F2PY and SWIG, have been developed in recent years to assist the integration and, in simpler cases, fully automate it. The present chapter is a first introduction to mixed language programming with Python, Fortran 77 (F77), C, and C++. The focus is on applying the tools F2PY and SWIG to automate the integration process.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   74.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Langtangen, H.P. (2004). Combining Python with Fortran, C, and C++. In: Python Scripting for Computational Science. Texts in Computational Science and Engineering, vol 3. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-05450-5_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-05450-5_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-05452-9

  • Online ISBN: 978-3-662-05450-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics