[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] bind error : "bad prototype syntax"
From: |
David Dreisigmeyer |
Subject: |
Re: [Chicken-users] bind error : "bad prototype syntax" |
Date: |
Thu, 9 Dec 2010 13:02:04 -0500 |
Hi Felix,
I'm getting the following errors now:
$ csc cl.scm -framework OpenCL
cl.c: In function ‘stub359’:
cl.c:124: warning: passing argument 4 of ‘clEnqueueNDRangeKernel’ from
incompatible pointer type
cl.c:124: warning: passing argument 5 of ‘clEnqueueNDRangeKernel’ from
incompatible pointer type
cl.c:124: warning: passing argument 6 of ‘clEnqueueNDRangeKernel’ from
incompatible pointer type
cl.c: In function ‘stub332’:
cl.c:137: warning: passing argument 6 of ‘clGetKernelWorkGroupInfo’
from incompatible pointer type
cl.c: In function ‘stub224’:
cl.c:199: warning: passing argument 6 of ‘clGetProgramBuildInfo’ from
incompatible pointer type
cl.c: In function ‘stub175’:
cl.c:224: warning: passing argument 4 of ‘clCreateProgramWithSource’
from incompatible pointer type
cl.c: In function ‘stub132’:
cl.c:248: warning: passing argument 4 of ‘clCreateContext’ from
incompatible pointer type
The offending pointer type is size_t * .
A more general question. When I look at the gl.scm file from the
opengl egg it looks like gl.h with the following around it:
;;;; gl.scm
(require-library easyffi)
(module gl *
(import scheme chicken (except foreign foreign-declare) easyffi)
(cond-expand
(msvc
#>
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include "glprocs/GL/gl.h"
#include "glprocs/GL/glprocs.h"
<#)
(else
#>
#ifdef C_MACOSX
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
<#))
(foreign-parse #<<EOF
___declare(export_constants, yes)
___declare(substitute, "^(GL_|gl);gl:")
......
EOF
)
(cond-expand
(windows)
(else
(foreign-parse #<<EOF
......
EOF
)))
)
(I'm not 100% sure since my gl.h seems like a different version.)
Would there be a way for bind to work directly on the gl.h file
itself?
I must not be understanding how to use bind beyond the problems above.
For example, I write the following fib.c:
// fib.c
int fib(int n) {
int prev = 0, curr = 1;
int next;
int i;
for (i = 0; i < n; i++) {
next = prev + curr;
prev = curr;
curr = next;
}
return curr;
}
and the following fib.h:
// fib.h
int fib(int);
Now, with fib-user.scm:
;;; fib-user.scm
(require-extension bind)
(module fib-user *
(import scheme chicken foreign bind)
(foreign-declare "#include \"fib.h\"")
(bind #<<EOF
#include "fib.h"
int fib(int);
EOF
))
I run the following:
csc fib-user.scm fib.c
and everything seems fine. At the REPL I do:
#;1> ,l /my/path/to/fib-user
and receive the following error:
; loading /my/path/to/fib-user ...
Error: unbound variable: |address@hidden@address@hidden@address@hidden@^@ |
Thanks again, -Dave
On Thu, Dec 9, 2010 at 3:27 AM, Felix
<address@hidden> wrote:
> From: David Dreisigmeyer <address@hidden>
> Subject: [Chicken-users] bind error : "bad prototype syntax"
> Date: Wed, 8 Dec 2010 10:26:44 -0500
>
>> For the attached scheme file I'm getting the error below. The line
>> it's complaining about looks like this:
>>
>
> Add:
>
> #define CL_API_CALL
> #define CL_API_SUFFIX__VERSION_1_0
> #define CL_API_ENTRY
>
> I also had to add these to make it compile:
>
> typedef int cl_int;
> typedef unsigned int cl_uint;
> typedef unsigned int cl_mem_flags;
> typedef unsigned long cl_ulong;
>
> I also recommend to use `bind' (not `bind*') and to add
>
> (foreign-declare "#include <OpenCL/cl.h>")
>
> at the start of your file.
>
>
> cheers,
> felix
>