Re: Migrating from UFFI to CFFI

Victor <[email protected]> Sun, 20 Oct 2013 21:38:27 +0300
Newsgroups gmane.lisp.clsql.general
Message-ID <op.w49nedme4lizsz@vanyakin-nb>
On Sun, 20 Oct 2013 05:39:35 +0300, Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> wrote:

> On Oct 19, 2013, at 2:33 PM, Victor <[email protected]> wrote:
>> 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.
>
> Yes, that is its only function.
>
>> "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.
>
> The decision to undergo to effort to write and test the native C
> function was not taken lightly. If one wants to take time to try a version
> of CLSQL using an all Lisp implementation and benchmark it against the
> current version on a number of platforms and see that it performs well,
> I'd love to drop the C interface. For my application, this is a function
> is called hundreds of millions of times and optimization is important.
>
>> 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
>
> The problem is supporting both 32-bit and 64-bit lisp implementations.
> At the time I wrote this, not all of the implementations had a way to handle
> 64-bit results on a 32-bit implementation.
>
>>  What do you think? Are there better ways out?
>
> We can discuss a lot of pros and cons of various approachs, but I
> don't think any of them seem will be as time efficient as you
> getting the current C library compiled on your platform.
> Over the years, I compiled this on very many platforms without much effort.
> I think the uffi/Makefile.msvc would be a useful starting point.
> Perhaps a search of the mail list archive would identify other
> instructions, but I am not certain that this compilation
> step has been discussed. Also, the last I heard was Microsoft
> had a free "express" version of their C compiler available.
>

Hi Kevin,

I tried to work without the clsql_uffi library on Linux (Ubuntu) and
will try these modifications on the "problematic" Windows 7 system
tomorrow. Diff for the changes is here:

https://github.com/vityok/clsql/commit/eabede9da3e61ef5191b601dcf9b30f30f613f3e

Actually, I would like to avoid dependencies as much as possible.

I would like to ask participants of this mailing list who have
interest in this issue to review the modifications. Your comments are
very welcome!

Thanks,
Victor