Re: undefine_c_func (was: memory profiling)

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

Michael J. Sabal wrote:
> 
> Chris Bensler wrote:
> > 
> > Oops, I missed poking the null terminator (not needed for printf anyway)
> > And I also didn't declare printf as cdecl "+printf" (all variadic functions
> > are cdecl)
> > 
> 
> I tried running your code with these modifications under 2 scenarios:  
> define_c_proc("","+printf",{C_UINT}) and define_c_proc(open_dll("libc.so"),
> "+printf",{C_UINT}).  Neither was able to link to the C function, not even
> when I changed C_UINT to C_POINTER.  I gave up and just recoded the GTK 
> routine I was after in Euphoria.  I'm sure there are other variadics out there
> that I won't be able to cheat so easily, so it's important for the community
> that we find a way to prove that it works without rewriting the functions in
> Euphoria.  If we can't (and so far we're 0 for 2), we may need a source
> mod to enable that functionality.

You might need to import as "+_printf", since that's what compilers usually 
do with cdecl exports.

You could also use fptr.e (in the archives) which uses assembly to push
the args.  You can use define_c_var to simply get the address of the 
exported function.

The easier solution is probably Pete's, however.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu