C++ to C# Wrapper

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kuba Florczyk

    #1

    C++ to C# Wrapper

    Hi

    How to write method in wrapper for method from C++:

    HRESULT Add(WCHAR *wcPath)

    ???

    I've write something like this

    int Add(string wcPath)

    and it's doesn't work :(

    regards
    kuba florczyk


  • Brian W

    #2
    Re: C++ to C# Wrapper

    How about ...

    public class MyWrapper
    {
    [DllImport("MyDl l.dll", SetLastError=tr ue, CharSet=CharSet .Auto)]
    public static IntPtr Add(string wcPath);
    }

    Since, however, this is returning an HRESULT, is this method on a COM
    object? If yse you must use COM Interop.

    Hope this helps
    Brian W



    "Kuba Florczyk" <chomik77@poczt a.onet.pl> wrote in message
    news:epna$zEjDH A.2636@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Hi
    >
    > How to write method in wrapper for method from C++:
    >
    > HRESULT Add(WCHAR *wcPath)
    >
    > ???
    >
    > I've write something like this
    >
    > int Add(string wcPath)
    >
    > and it's doesn't work :(
    >
    > regards
    > kuba florczyk
    >
    >[/color]


    Comment

    • Kuba Florczyk

      #3
      Re: C++ to C# Wrapper

      Thx. It's work!

      kuba florczyk

      U¿ytkownik "Brian W" <brianw@gold_de ath_2_spam_rush .com> napisa³ w
      wiadomoœci news:OUmzjhFjDH A.3644@TK2MSFTN GP11.phx.gbl...[color=blue]
      > How about ...
      >
      > public class MyWrapper
      > {
      > [DllImport("MyDl l.dll", SetLastError=tr ue, CharSet=CharSet .Auto)]
      > public static IntPtr Add(string wcPath);
      > }
      >
      > Since, however, this is returning an HRESULT, is this method on a COM
      > object? If yse you must use COM Interop.
      >
      > Hope this helps
      > Brian W
      >
      >
      >
      > "Kuba Florczyk" <chomik77@poczt a.onet.pl> wrote in message
      > news:epna$zEjDH A.2636@TK2MSFTN GP11.phx.gbl...[color=green]
      > > Hi
      > >
      > > How to write method in wrapper for method from C++:
      > >
      > > HRESULT Add(WCHAR *wcPath)
      > >
      > > ???
      > >
      > > I've write something like this
      > >
      > > int Add(string wcPath)
      > >
      > > and it's doesn't work :(
      > >
      > > regards
      > > kuba florczyk
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...