[plt-scheme] No ODBC for DrScheme?
If you haven't found the MSDN docs, they are here:
http://msdn.microsoft.com/en-us/library/ms709378(VS.85).aspx
You will need to get hold of the ODBC header files.
You want to define the basic data structures in ODBC (handles and so
on). These are mostly, I think, opaque values so you can just use
_cpointer as a first pass. Then get hold of the obdc library and
start defining functions. Test every step of the way, 'cause if you
make an error it will be very difficult to debug otherwise.
Here's a basic outline (untested):
(require scheme/foreign)
(define-cpointer-type _SQLHENV)
; etc ... You need SQLRETURN and friends. See sqltypes.h
(define libodbc (ffi-lib "libodbc"))
;; Start defining functions
(unsafe!)
;SQLRETURN SQLAllocHandle(
; SQLSMALLINT HandleType,
; SQLHANDLE InputHandle,
; SQLHANDLE * OutputHandlePtr)
(define SQLAllocHandle
(get-ffi-obj
"SQLAllocHandle"
libodbc
(_fun _SQLSMALLINT _SQLHANDLE _SQLHANDLE_pointer -> _SQLRETURN)))
On Fri, Jul 17, 2009 at 7:05 AM, misterlight<mister.light at gmail.com> wrote:
...
> I started reading the documentation and found the appropriate DLL on
> my pc. Supposing that I'd like to try it, since I have no experience
> at all with FFI, are there some "standard steps" that you suggest to
> follow?
>
> Kind regards,
> ml
>