4

I am trying to make c# project and i need to use a solver which i found on the internet to do some calculation but this solver is a static library which writing in c++ .

it is so difficult to rewrite this library in .Net and that will take too much time.

i read some articles about it liking making a managed c++ but i don't know what is the simplest solution to use that .lib in c# project ?

this is the static library

Ameer Mansour
  • 53
  • 1
  • 10
  • 1
    Refer [this](https://social.msdn.microsoft.com/Forums/vstudio/en-US/299da822-5539-4e5b-9ba7-b614e564c9f4/presenting-a-c-library-lib-for-use-in-c-project?forum=vcgeneral) link. The link shows the way to handle your issue. – Microsoft DN Jun 02 '15 at 06:32
  • See https://www.google.com/search?q=lib+to+dll+converter – Zotta Jun 02 '15 at 07:10
  • Managed C++ is almost the only way. You just have expose the managed interface to the static library. That said, C++ is completely crazy - even just compiling a simple project like this with a statically linked library might take you much longer than you expect. If your only significant experience is with C#, this might prove quite a challenge :) – Luaan Jun 02 '15 at 07:18
  • @Luaan i made it but i have a problem !! i have class GuillotineBinPack which is not managed c++ , it is working well in my application but the problem is i want to create some function that i had to pass to it an instance from that class by reference so do i have to change that class to managed c++ or there is other way better than modifying that class ? – Ameer Mansour Jun 03 '15 at 07:47
  • Why would you ever need to pass a class? You really only want to pass structures and primitives, not classes (How would that even work? As a proxy to calls to managed code?). What are you trying to do? – Luaan Jun 03 '15 at 08:11
  • thank you :D , i fixed it in other way i made that function return two parameters using std::pair instead of using references ... – Ameer Mansour Jun 03 '15 at 09:49
  • @Luaan can you please check this ? http://stackoverflow.com/questions/30620421/managed-class-member-varible-from-managed-struct – Ameer Mansour Jun 03 '15 at 12:42

0 Answers0