How to pass PVOID* to native code from managed code - DOTNET

This is a discussion on How to pass PVOID* to native code from managed code - DOTNET ; Hi, I need to call a native windows method which has the following signature BOOL SomeMethod(PVOID* value); value [out] - The original value. I am calling this method using DllImport and am passing in an IntPtr. Intptr val = IntPtr.Zero; ...

+ Reply to Thread
Results 1 to 3 of 3

How to pass PVOID* to native code from managed code

  1. Default How to pass PVOID* to native code from managed code

    Hi,

    I need to call a native windows method which has the following
    signature

    BOOL SomeMethod(PVOID* value);

    value [out] - The original value.

    I am calling this method using DllImport and am passing in an IntPtr.

    Intptr val = IntPtr.Zero;
    bool status = SomeMethod(val);

    but this results in the method returning failure and GetLastError
    gives me error code 1. (ERROR_INVALID_FUNCTION)

    I suspect that this is because I am not passing in the correct data
    type from the managed code.
    What managed datatype should I use for a PVOID* ?

    Thanks,
    Roshan


  2. Default Re: How to pass PVOID* to native code from managed code

    >I suspect that this is because I am not passing in the correct data
    >type from the managed code.
    >What managed datatype should I use for a PVOID* ?


    out IntPtr


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

  3. Default Re: How to pass PVOID* to native code from managed code

    >I suspect that this is because I am not passing in the correct data
    >type from the managed code.
    >What managed datatype should I use for a PVOID* ?


    out IntPtr


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

+ Reply to Thread

Similar Threads

  1. Using a managed library from native code
    By Application Development in forum DOTNET
    Replies: 3
    Last Post: 03-11-2007, 07:30 AM
  2. Native code unloads before Managed code
    By Application Development in forum DOTNET
    Replies: 1
    Last Post: 08-31-2006, 08:04 AM
  3. reserving array in unmanaged code and pass it to managed code
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 06-08-2006, 05:48 AM
  4. Compilation of managed code (IL) into native code
    By Application Development in forum DOTNET
    Replies: 4
    Last Post: 03-01-2006, 02:20 PM