[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: type friction C <-> scheme
From: |
Catonano |
Subject: |
Re: type friction C <-> scheme |
Date: |
Sun, 11 Jun 2017 20:20:24 +0200 |
Matt,
thank you for spending some time on this
2017-06-11 20:01 GMT+02:00 Matt Wette <address@hidden>:
>
> > On Jun 9, 2017, at 1:36 PM, Catonano <address@hidden> wrote:
> >
> > Here we go again
> >
> > After successfully wrapping freexl_open, I can't do the same with
> > freexl_get_info
>
> Note that my fyi-helper is not working yet, but here is the current output
> if I feed it freexl.h
>
> ;;
> ;; auto-generated by ffi-help.scm
> ;;
>
> (define-module (freexl)
> #:use-module (ffi-help)
> #:use-module ((system foreign) #:prefix ffi:)
> #:use-module ((bytestructures guile) #:prefix bs:)
> )
> (define bs:struct bs:bs:struct)
>
> (define lib-link (dynamic-link #f))
> (define (lib-func name) (dynamic-func name lib-link))
>
> ;; (struct . "FreeXL_CellValue_str")
> ;; ... failed.
>
> ;; "FreeXL_CellValue"
>
> ;; typedef struct FreeXL_CellValue_str FreeXL_CellValue;
> (define-std-pointer-wrapper FreeXL_CellValue*)
>
> ;; "freexl_version"
>
> ;; extern const char *freexl_version(void);
> (define freexl_version
> (let ((f (ffi:pointer->procedure
> '*
> (lib-func "freexl_version")
> (list))))
> (lambda () (let () (identity (f))))))
> (export freexl_version)
>
> ;; "freexl_open"
>
> ;; extern int freexl_open(const char *path, const void **xls_handle);
> (define freexl_open
> (let ((f (ffi:pointer->procedure
> ffi:int
> (lib-func "freexl_open")
> (list '* '*))))
> (lambda (path xls_handle)
> (let ((~path (identity path))
> (~xls_handle (identity xls_handle)))
> (f ~path ~xls_handle)))))
> (export freexl_open)
>
Ok, my version of fffreexl_open does work
>
> ;; "freexl_open_info"
>
> ;; extern int freexl_open_info(const char *path, const void **xls_handle);
> (define freexl_open_info
>
> ;; "freexl_close"
>
> ;; extern int freexl_close(const void *xls_handle);
> (define freexl_close
>
I didn't attempt ffrexxl_open_info and frexxl_close yet
>
> ;; "freexl_get_info"
>
> ;; extern int freexl_get_info(const void *xls_handle, unsigned short what,
> ;; unsigned int *info);
> (define freexl_get_info
> (let ((f (ffi:pointer->procedure
> ffi:int
> (lib-func "freexl_get_info")
> (list '* ffi:unsigned-short '*))))
> (lambda (xls_handle what info)
> (let ((~xls_handle (identity xls_handle))
> (~info (identity info)))
> (f ~xls_handle what ~info)))))
> (export freexl_get_info)
>
this doesn't seem so different from what I did
I shoul try to call this one iin the REPL and see what happens
Thanks, I'll let you know
- Re: type friction C <-> scheme, (continued)
- Re: type friction C <-> scheme, Mike Gran, 2017/06/09
- Re: type friction C <-> scheme, Matt Wette, 2017/06/09
- Re: type friction C <-> scheme, Catonano, 2017/06/09
- Re: type friction C <-> scheme, Matt Wette, 2017/06/09
- Re: type friction C <-> scheme, Catonano, 2017/06/10
- Re: type friction C <-> scheme, Mark H Weaver, 2017/06/11
- Re: type friction C <-> scheme, Matt Wette, 2017/06/11
- Re: type friction C <-> scheme, Catonano, 2017/06/11
Re: type friction C <-> scheme, Matt Wette, 2017/06/11