Creating wrapper on c/c++ code to access it as assembly in c# code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zacksoniar
    New Member
    • Sep 2007
    • 45

    #1

    Creating wrapper on c/c++ code to access it as assembly in c# code

    Hello Friends,

    I have one vc++ 6.0 library which i want to access in C# project.

    As it is object oriented library(class & structures), DllImport is NOT an option.

    So what I did so far is :

    1. Opened vc++ code with VS2010.
    2. Made it CLR(/clr) enabled.
    3. Project Compiled successfully.

    4. Now I started creating CLR friendly wrapper for pure
    c++ code which I managed to do.

    My problem is there is one c++ function with signature

    Code:
    void GetCoefficients(double &k1, double &k2);
    For this, I created wrapper with same signature but when
    I access it in c#, I am not able to pass values to it.

    "ref" keyword is not working.

    So my questions are...
    1. What should be clr aware wrapper's signature for this function?

    2. How should I call it from c#?

    your help is really appreciated.

    Thanks,
    Zack
Working...