Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part 4: Reaching out with IronPython > Extending IronPython with C#/VB.NET

14. Extending IronPython with C#/VB.NET

This chapter covers
  • Creating class libraries for IronPython

  • .NET attributes and IronPython

  • Calling unmanaged code with P/Invoke

  • Creating dynamic objects with C#/VB.NET

  • Compiling assemblies at runtime


There is a standard mantra about performance when programming with Python (CPython). The mantra goes something like this: “Code in Python first; then profile and optimize your bottlenecks. Finally, if you still need your code to run faster, rewrite the performance-sensitive parts of your code in C.” Okay, as mantras go there are probably snappier ones, but it still contains a lot of wisdom. Of course, with IronPython we wouldn’t drop down to C[1] but into C# or VB.NET instead.

[1] Well, not usually. There are tools like SWIG that will allow you to generate .NET wrappers for C/C++ libraries.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial