On Mon, Aug 17, 2020 at 10:42 PM Yonatan Gizachew <
eme...@gmail.com> wrote:
>
> Sorry I couldn't provide code to reproduce the case, but I just wanted to know if there are known cases for my issue.
> From the golang source code, in the runtime library proc.go file there is this code snippet
>
https://github.com/golang/go/blob/a745171e6b30394b661a040d04e8807b4bd0c7da/src/runtime/proc.go#L199
> In my case, I build my go program with -buildmode=c-shared mode and I loaded it dynamically to my program written in C. So as to load the runtime go libraries dynamically, I preferred to use the gccgo compiler instead of gc compiler. Here is how I built my go code.
>
> $ go build -o libgotest.so -buildmode=c-shared -compiler=gccgo test.go
>
> I was hoping the linker would set the islibrary flag to True and as a result the main function in proc.go would return at line 202. But it wasn't the case.
>
> I was wondering why islibrary was set false.
Note that gccgo uses a different runtime package. Your link is to the
gc runtime package, not the gccgo runtime package.
gccgo sets isarchive for both c-archive and c-shared. As this is an
internal runtime variable, it shouldn't make any difference. Does it
ever make a difference to your code that gccgo sets isarchive rather
than islibrary?
Ian