On Wed, 2011-11-30 at 15:06 -0500, David Malcolm wrote:
[...snip...]
> Any thoughts on how to address this?  Are there any other approaches
> I've missed?

Answering my own question, Dave Korn pointed out in another thread:
  http://gcc.gnu.org/ml/gcc/2011-01/msg00310.html
that one can use dlsym() to try to load a symbol from out of the
frontend executable.

This works: I can use dlsym() to get the symbol out of cc1plus, and I
get NULL when trying to do the same from other language frontends.

This still has the downside of a lack of type safety: I have to cast the
symbol at the callsite to a function pointer of the correct type, and
this has to match that of the declaration.

But it does work, and it appears that this approach will work for the
various other places where I want to add frontend-specific calls
to the plugin.

FWIW, the relevant commit to my plugin is:
http://git.fedorahosted.org/git/?p=gcc-python-plugin.git;a=commitdiff;h=2bb77306c37bb03a616c2554cfbf25dc02640b43#patch2

Hope this is helpful
Dave

Reply via email to