Hi Kevin,
I think Dehydra is a perfect tool for FFI generation, so I hope you succeed.
My schedule is a little hectic today, so I'll be brief. There are a 
couple of tricky things here.
a) Linking. The plugin code needs to be modified such that it does not 
try to call functions from the C++ frontend. Need to link stuff lazily I 
think, and then have code notice that functions resolve to null and not 
do c++-specific stuff. There might be some other similarly messy linker 
stuff too.
b) Iterating over types and functions. global_namespace is mostly used 
to iterate over  classes/structs/enums. I think you  can get that 
functionality by hooking into finish_struct() stuff. I think something 
similar  to global_namespace exists to get a list of toplevel functions 
in the C frontend.

Here is the bug on it https://bugzilla.mozilla.org/show_bug.cgi?id=421097

I hope this helps.

Taras

Kevin Tew wrote:
> Yeah I came to the same conclusion.
> all_translation_units looks like the right starting place, but it is 
> statically scoped so plugin callbacks probably need to be added to 
> gcc/top-level.c or somewhere.
>
> Taras, if you could outline your plan of attack, I would take a crack 
> at the implementation work.  I'd like to use dehydra to transform c 
> header files into FFI signatures for Parrot.
>
> Kevin
>
> On Mon, May 5, 2008 at 11:56 AM, Taras Glek <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi Guys,
>     There is no equivalent of global_namespace in the C frontend. Tom,
>     the C++ front end is just better :)
>     I will make the plugins work in C as soon as I  have a chance.
>     There is a bug filed for it.
>
>     Taras
>
>
>     Tom Tromey wrote:
>
>                             "Kevin" == Kevin Tew <[EMAIL PROTECTED]
>                             <mailto:[EMAIL PROTECTED]>> writes:
>
>
>         Kevin> I tried using gcc_dehydra.so from gcc, but ran into
>         unknown symbol:
>         Kevin> global_namespace.  There has to be a top-level compile
>         unit tree that
>         Kevin> could be used in gcc in place of global_namespace.
>
>         Look in c-decl.c.  Maybe all_translation_units is what you
>         want.  Also
>         look at ext_block and pop_file_scope.
>
>         Tom
>
>
>

_______________________________________________
Dev-static-analysis mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-static-analysis

Reply via email to