Chapter 9. LIBRARIES

A great deal of time and effort has been put into existing software. Many libraries have resulted from years of development and the ability to reuse this work is essential. There are two different forms of library of interest to the F# programmer:

  • .NET libraries

  • Native libraries

The .NET platform is famous for providing a wealth of library functions, particularly in the contexts of web and GUI programming. These libraries will be of interest to F# programmers primarily for the useful functionality that they provide, such as graphing tools. Many third party libraries are available for the .NET platform and we shall endeavour to cite those that we have found to be most useful and of the highest quality.

The term native library refers to platform-specific libraries that typically predate the .NET platform. The few remaining native libraries that have not been succeeded by .NET libraries are desirable primarily because they offer exceptionally high per-formance.

This chapter describes built-in functionality provided with the .NET platform as well as the use of both .NET and native libraries.

LOADING .NET LIBRARIES

On the .NET platform, extra functionality is typically provided in the form of a Dynamically Linked Library (DLL). These files have the suffix ".dll" and can be loaded into an F# interactive session or referenced from a compiled F# program using the #r directive. For example, the following loads the "XYGraph.dll" library:

> #r "XYGraph.dll";;

A set of directories ...

Get F# for Scientists now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.