It doesn't work even if I set CallingConvention. It fails on EntryPointNotFound exception.
Ti Ny > From: [EMAIL PROTECTED] > To: sqlite-users@sqlite.org > Date: Thu, 27 Nov 2008 19:57:30 +0100 > Subject: Re: [sqlite] sqlite3_open16 fails on Windows Vista 64b > > The given code is correct. The lower-case string is a C# alias for the > System.String class. System.Int64 is an opaque 64-bit pointer value. > > The code so far is correct. What is missing though is the calling > convention, which by default is cdecl, but .NET doesn't use that one > by default for P/Invoke. It uses stdcall/winapi as the default calling > convention. Change the CallingConvention in the DllImport line. > > Additionally using CharSet=CharSet.Unicode adds an implicit W as per > Win32 calling conventions to the function name. Since the sqlite3_open16 > doesn't have that you need to use ExactSpelling to prevent it from adding > that W. > > Instead of rolling your own P/Invoke wrapper I'd suggest using one of > the available .NET wrappers for SQLite. > > Mike > > > -----Ursprüngliche Nachricht----- > > Von: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Im Auftrag von > > Sherief N. Farouk > > Gesendet: Donnerstag, 27. November 2008 18:26 > > An: 'General Discussion of SQLite Database' > > Betreff: Re: [sqlite] sqlite3_open16 fails on Windows Vista 64b > > > > > I am calling now this: > > > > > > [DllImport("sqlite3.dll", CharSet = CharSet.Unicode)] > > > internal static extern System.Int64 sqlite3_open16(string > > > filename, out IntPtr handle); > > > > > > I now finds an entry point, but i returned to the previous error: > > > An attempt was made to read program in invalid format. > > > > > > But now everything is 64bit. > > > > > > Ti Ny > > > > > > > No offense, but I'm beginning to believe you don't fully > > grasp what you're trying to do. First of all, if DW can't > > find the entry point then it's not there. Second, I don't > > think the CLR type corresponding to the return value of > > sqlite3_open16 is System.Int64, and I'm not sure what string > > is (CLR's string type is String, capital S). How about you > > upload that DLL of your somewhere, send a link and I wouldn't > > mind checking it for you. > > > > - Sherief > > > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _________________________________________________________________ Explore the seven wonders of the world http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users