Re: define_c_func/proc and 64-bit return types

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

I'm trying to wrap a function that returns a int64_t value.

I know I can pass int64_t as a long long via two C_LONG values:

procedure some_routine( atom param ) 
    atom hi_dword = and_bits( param / #100000000, #FFFFFFFF ) 
    atom lo_dword = and_bits( param, #FFFFFFFF ) 
    c_proc( xsome_routine, {lo_dword,hi_dword} ) 
end procedure 

But how (or can) I do the reverse?

It would be nice if I could declare the function like this:

constant xsome_routine = define_c_func( somelib, "some_routine", {}, {C_LONG,C_LONG} ) 

And then get back {lo_dword,hi_dword} when I call the function.

Although I suppose the best declaration would simply be:

constant xsome_routine = define_c_func( somelib, "some_routine", {}, C_LONGLONG ) 

-Greg

I'm not sure if you can with 4.0 .. but 4.1 actually has a C_LONGLONG type and has support for doing this builtin already.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu