This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Using Go to build a shared library to be called from C
- From: Ian Lance Taylor <iant at google dot com>
- To: LRN <lrn1986 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Jun 2011 14:24:42 -0700
- Subject: Re: Using Go to build a shared library to be called from C
- References: <4DF6362F.7030003@gmail.com>
LRN <lrn1986@gmail.com> writes:
> However, if i put anything more complex than "return 1" into Myfunc in
> Go (such as using fmt.Printf() or returning a string - with
> appropriate prototype changes to 'string' and 'char*' in Go and C,
> naturally), it segfaults at runtime.
>
> Is that a limitation of gccgo, a bug, or am i simply doing something wrong?
This is a current limitation of gccgo. At present nothing initializes
the packages imported by a packaged compiled into a shared library.
This is fixable with a bit of thought but is not high on the priority
list.
Ian