Looking for help with accessing the cmsTempFromWhitePoint() function from
C#.

My import statement is as follows:

[DllImport(@lcms2Path)]
public static extern bool cmsTempFromWhitePoint(IntPtr TempK, IntPtr
WhitePoint)

The WhitePoint CIE xyY is declared this way:

[StructLayout(LayoutKind.Sequential)]   
public struct cmsCIExyY
{
     public double x;
     public double y;
     public double Y;
};

I create variable to hold CIExyY structure this way:

cmsCIExyY CIExyY;

My function call looks like this:

IntPtr TempK = IntPtr.Zero;
IntPtr unmanagedAddr = Marshal.AllocHGlobal(Marshal.SizeOf(CIExyY));
// Allocate unmanaged memory
Marshal.StructureToPtr(CIExyY, unmanagedAddr, true);
// marshall the structure to the memory

bool Result = cmsTempFromWhitePoint(tempK, unmanagedAddr); 

But I get "Assertion failed" when executing the call:

(TempK != ((void *)0))


I am confident in my code to marshall the CIExyY structure from managed to
unmanaged memory.
But I have no clue how to approach the TempK pointer?

I think the error says "Wrong type of Pointer" was supplied.

Best / Roger


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to