Re: Migrating from UFFI to CFFI

Victor <[email protected]> Sat, 19 Oct 2013 23:33:12 +0300
Newsgroups gmane.lisp.clsql.general
Message-ID <op.w47x1mhi4lizsz@vanyakin-nb>
On Sat, 19 Oct 2013 05:53:10 +0300, Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> wrote:

> On Oct 18, 2013, at 4:22 AM, Victor <[email protected]> wrote:
>> I've got yet new issues that I did not anticipate: on Windows 7 with
>> Clozure CL 1.9 loading clsql-sqlite3 fails due to the missing .dll:
>>
>> | The program can't start because MSVCR71.dll is missing from your
>> | computer. Try reinstalling the program to fix this problem.
>>
>> If this error is ignored, the next one pops up:
>>
>> | clsql_uffi.lib is either not designed to run on Windows or it contains
>> | an error.
>>
>> As far as I understand the vcr71 library is a deliverable component
>> of the Visual Studio that the clsql_uffi.dll relies on.
>
> That is a microsoft visual C runtime library, though I don't know if the
> version being asked for relates to the binary of clsql_uffi.dll or some
> other component of your windows installation.  I don't develop for windows,
> but a simple character match in the binary doesn't find MSVCR71.
>
> I see the file data of clsql_uffi.dll is over 5 years ago. You may do
> well to compile clsql_uffi.c with a more current C compiler -- perhaps
> using the same compiler that you are using for SQLite.
>
> clsql_uffi.c is a simple file with only a single short function that
> should be easy to compatible with most all windows C compilers.
>

Hi Kevin,

Unfortunately compiling the C sources is not really an option: I did
not do this on Windows long enough and I think that it is not really
needed.

I think that it is possible to get rid of this library: the only
useful function that it provides is "atol64" that converts a string to
a 64 bit integer.

"atol64" is used in the "CONVERT-RAW-FIELD" function. As far as I
understand it could be replaced by calling PARSE-INTEGER on the string
in Lisp. This will make the native library not really needed.

Another option is to use a standard C/C++ function to do this task as
described in this StackOverflow thread:

http://stackoverflow.com/questions/7502926/what-is-atoi-equivalent-for-64bit-integeruint64-t-in-c-that-works-on-both-unix/7503328#7503328

What do you think? Are there better ways out?

Thanks,
Victor