Actually just solved the problem...

C# code

in SQLite.cs, add


[DllImport("sqlite3", EntryPoint = "sqlite3_value_blob", CallingConvention
= CallingConvention.Cdecl)]

public static extern IntPtr valueBlob (IntPtr value);

[DllImport("sqlite3", EntryPoint = "sqlite3_value_bytes", CallingConvention
= CallingConvention.Cdecl)]

public static extern int valueBytes (IntPtr value);



in callback func



public static void rank (IntPtr DatabaseConnectionHandle, int
numberOfValues, IntPtr[] apVal)

{

......

    int len = SQLite3.valueBytes(apVal[0]);

    int numInts = len / sizeof(Int32);

    int[] theValues = new int[numInts];

    IntPtr ptr = SQLite3.valueBlob(apVal[0]); // Return value from
matchinfo()

    for (int count = 0; count < numInts ; count++) {

        if (count > 0)

        ptr = IntPtr.Add(ptr, sizeof(Int32));

        theValues[count] = Marshal.ReadInt32(ptr);

    }



... do ranking calc

}

Sent from Windows Mail

 *From:* Kenneth Grant <[email protected]>
*Sent:* November 28, 2012 6:24 AM
*To:* [email protected]
*Subject:* Accessing matchinfo() from metro

Using the SQLite3 DLL ind Windows 8 metro with the C# managed code wrapper
work just great. And adding marshaling code for a ranking function also
works (as long as you keep a static var referencing the function and use
that var as the registration reference). But, the argument for the info
passed to the ranking function is not helpful as managed code can only
reference a pointer to a single object like a long, int, etc. general
pointers are not allows in managed code.

So the question is, has anybody solved this call-back issue.

Sent from my iPad
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to