pub fn build_with_options(&self, device: &Device, options: &str) -> Result<String, String>
    {
        unsafe
        {
            let options = CString::new(options).unwrap();
            let ret = clBuildProgram(self.prg, 1, &device.id,
                                     options.as_ptr(),
                                     mem::transmute(ptr::null::<fn()>()),
                                     ptr::null_mut());
            // Get the build log.
            let mut size = 0 as libc::size_t;
            let status = clGetProgramBuildInfo(
                self.prg,
                device.id,
                CL_PROGRAM_BUILD_LOG,
                0,
                ptr::null_mut(),
                (&mut size));
            check(status, "Could not get build log");

            let mut buf : Vec<u8> = repeat(0u8).take(size as usize).collect();
            let status = clGetProgramBuildInfo(
                self.prg,
                device.id,
                CL_PROGRAM_BUILD_LOG,
                buf.len() as libc::size_t,
                buf.as_mut_ptr() as *mut libc::c_void,
                ptr::null_mut());
            check(status, "Could not get build log");

            let log = String::from_utf8_lossy(&buf[..]);
            if ret == CL_SUCCESS as cl_int {
                Ok(log.into_owned())
            } else {
                Err(log.into_owned())
            }
        }
    }
/// Build the program for a given device.
///
/// Both Ok and Err returns include the build log.
Build the program for a given device.
Both Ok and Err returns include the build log.
Build the program for a given device . Both Ok and Err returns include the build log .
pub fn build_with_options(&self, device: &Device, options: &str) -> Result<String, String>
    {
        unsafe
        {
            let options = CString::new(options).unwrap();
            let ret = clBuildProgram(self.prg, 1, &device.id,
                                     options.as_ptr(),
                                     mem::transmute(ptr::null::<fn()>()),
                                     ptr::null_mut());
            // Get the build log.
            let mut size = 0 as libc::size_t;
            let status = clGetProgramBuildInfo(
                self.prg,
                device.id,
                CL_PROGRAM_BUILD_LOG,
                0,
                ptr::null_mut(),
                (&mut size));
            check(status, "Could not get build log");
            let mut buf : Vec<u8> = repeat(0u8).take(size as usize).collect();
            let status = clGetProgramBuildInfo(
                self.prg,
                device.id,
                CL_PROGRAM_BUILD_LOG,
                buf.len() as libc::size_t,
                buf.as_mut_ptr() as *mut libc::c_void,
                ptr::null_mut());
            check(status, "Could not get build log");
            let log = String::from_utf8_lossy(&buf[..]);
            if ret == CL_SUCCESS as cl_int {
                Ok(log.into_owned())
            } else {
                Err(log.into_owned())
            }
        }
    }
pub fn build_with_options ( & self , device : & Device , options : & str ) -> Result < String , String > { unsafe { let options = CString :: new ( options ) . unwrap ( ) ; let ret = clBuildProgram ( self . prg , 1 , & device . id , options . as_ptr ( ) , mem :: transmute ( ptr :: null :: < fn ( ) > ( ) ) , ptr :: null_mut ( ) ) ; // Get the build log. let mut size = 0 as libc :: size_t ; let status = clGetProgramBuildInfo ( self . prg , device . id , CL_PROGRAM_BUILD_LOG , 0 , ptr :: null_mut ( ) , ( & mut size ) ) ; check ( status , " " ) ; let mut buf : Vec < u8 > = repeat ( 0u8 ) . take ( size as usize ) . collect ( ) ; let status = clGetProgramBuildInfo ( self . prg , device . id , CL_PROGRAM_BUILD_LOG , buf . len ( ) as libc :: size_t , buf . as_mut_ptr ( ) as * mut libc :: c_void , ptr :: null_mut ( ) ) ; check ( status , " " ) ; let log = String :: from_utf8_lossy ( & buf [ .. ] ) ; if ret == CL_SUCCESS as cl_int { Ok ( log . into_owned ( ) ) } else { Err ( log . into_owned ( ) ) } } }
Build the program for a given device.
Build the program for a given device .
&self
device
&Device
options
&str