Home > Uncategorized > Using Boost Math Library in C#

Using Boost Math Library in C#

How to access the functionallity in the boost libraries from the managed world is an interesting topic beeing addressed in the article. Apparantly, the cli compiler does not yet support the concurrency headers (like atomic). See https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3814789-support-c-11-concurrency-header-files-in-c-cli. This poses a problem when trying to make a managed wrapper. Another possible workaround is to build a unmanaged wrapper, in a static library, that does not expose any of the concurrency headers. Then the managed c++ wrapper assembly can link to the static library (creating a mixed mode assembly).



In this post I will share with you a lazy way to expose boost.math library to a C# project using C++/CLI. It is lazy and very wrong to do it this way, but I would like to share it with you anyway. I am doing this because of the following reasons:

  • Mixing different languages and frameworks is very difficult and error-prone. I have looked through tons of sites on ways to expose unmanaged functionality to the managed code, and apart from PInvoke, I have not found any stable and simple solution. Hopefully the step-by-step solution I am sharing may turn out to be helpful to someone one day.
  • My approach is by far not the best way to expose the Boost library to C#. But it is dead easy. I am aware of this, and if you know a better way – please let me know by contributing to this post.

View original post 790 more words

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: