[Mono-dev] Problem with Odbc on 64 bit identified, please advise action
Alan McGovern
alan.mcgovern at gmail.com
Tue Mar 18 19:53:45 EDT 2008
There's a slight issue with that unfortunately. If you're on Windows64, and
int is still an int32. If you're on nix64, an int is an int64. So, if you
*only* care about linux support, then the change you outlined is perfect,
however if you want to retain Win64 support, you can't do that.
There are two ways to enable support for both 64bit platforms.
1) Write 2 sets of p/invokes and detect at runtime which one you should
call. One exposes an int32, the other an int64.
2) Write a glue library in C which you p/invoke. This native library will
expose an int64 in it's public api (the one you p/invoke) and then the glue
library will call into the regular odbc32.dll library.
Which is suitable, i can't say. Someone else would have to decide that.
Alan.
On Tue, Mar 18, 2008 at 10:26 PM, Mads Bondo Dydensborg <mbd at dbc.dk> wrote:
> Hi there
>
> In libodbc.cs, imports are on this form:
>
> [DllImport("odbc32.dll")]
> internal static extern OdbcReturn SQLGetData (
> IntPtr StatementHandle,
> ushort ColumnNumber,
> SQL_C_TYPE TargetType,
> ref OdbcTimestamp TargetPtr,
> int BufferLen,
> ref int Len);
>
> BufferLen and Len are ints. However, on 64 bit odbc (tested with Debian
> 4.0/AMD using Sybase 9.0.2), they need to be long/64 bit. This works,
> whereas
> the above does not:
>
> [DllImport("odbc32.dll")]
> internal static extern OdbcReturn SQLGetData (
> IntPtr StatementHandle,
> ushort ColumnNumber,
> SQL_C_TYPE TargetType,
> ref OdbcTimestamp TargetPtr,
> System.Int64 BufferLen,
> ref System.Int64 Len);
>
> There are problem also other places, besides SQLGetData
>
> So, what to do? Should I just file a bug, or any suggestions on a patch? I
> have no idea about Odbc per se, I just needed this to work. :-/
>
> Regards
>
> Mads
>
> --
> Med venlig hilsen/Regards
>
> Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
> Dydensborg
> Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86
> 77 34
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080318/b65fb4cf/attachment-0001.html
More information about the Mono-devel-list
mailing list