Re: Wrapping a C library.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Okay, I've made the necessary changes, added a second example program, and posted the code to my BitBucket repository. I also renamed this project to eugnuplot so it's easier to identify.

https://bitbucket.org/ghaberek/eugnuplot

Oh, and here's the routine I used for allocating an array of float64 values.

function allocate_float64_array( object data, integer count=-1 ) 
 
    -- make sure we have an array of values 
    if atom( data ) then 
        data = {data} 
    end if 
 
    -- auto-detect the array length, if necessary 
    if count = -1 then 
        count = length( data ) 
    end if 
 
    -- allocate the block of memory 
    atom ptr = allocate( count * 8 ) 
 
    -- poke the values into memory 
    for i = 1 to count do 
        poke( ptr + (i-1) * 8, atom_to_float64( data[i] ) ) 
    end for 
 
    -- return the data pointer 
    return ptr 
end function 

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu