[Mono-list] Possible P/Invoke bug found in ODBC.NET
Brian Ritchie
brianlritchie@hotmail.com
Wed, 16 Oct 2002 00:11:54 -0400
I've run across what looks to be a bug with P/Invoke in mono...
In the ODBC.NET provider, I've declared a reference to an external dll as
follows...
[DllImport("odbc32.dll")]
public static extern OdbcReturn SQLDescribeCol(IntPtr StatementHandle,
ushort ColumnNumber, byte[] ColumnName, short BufferLength, ref short
NameLength, ref OdbcType DataType, ref short ColumnSize, ref short
DecimalDigits, ref short Nullable);
The OdbcType is an enumeration declared as:
public enum OdbcType : short
{
BigInt=-5,
Binary=-2,
...
}
This call works fine under ms.net...and the DataType parameter is returned
correctly. However, when run through mono on windows...it return 0. It
looks like mono isn't using the declared type of the enumeration: short.
I modified the code as follows...and it works in mono and ms.net...
[DllImport("odbc32.dll")]
public static extern OdbcReturn SQLDescribeCol(IntPtr StatementHandle,
ushort ColumnNumber, byte[] ColumnName, short BufferLength, ref short
NameLength, ref short DataType, ref short ColumnSize, ref short
DecimalDigits, ref short Nullable);
Could someone on the runtime side take a look at this?
Thanks,
Brian
BTW...
I've checked in the alternate Dllimport declaration for the ODBC.NET
provider so it will work in Mono.
Daniel, this should fix the problem you report to me today.
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963