Re: [go-nuts] Using go to write plugins for a C host application

2016-11-20 Thread ebw
Hi! Thanks for your answer!

Am Sonntag, 13. November 2016 21:42:20 UTC+1 schrieb Justin Israel:
>
>
>
> I had been down a similar path where I was trying to port a go library to 
> C++ via building a c-shared library and then delegating to it from a thin 
> C++ API. 
>
Turned out I hit problems with it in practice, in related to static thread 
> local storage model,
>
 
The host app I have in mind is single threaded so far and will likely stay 
that way for years to come.
Will that still be a problem in your opinion?

as well as signal handling conflicts in the host app.
>

I studied golang.org/pkg/os/signal and a fairly confident, that my 
coworkers and I can get
that working in our case.

Yours sincerely,

Eric Wolf 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Using go to write plugins for a C host application

2016-11-13 Thread Justin Israel
On Mon, Nov 14, 2016, 9:28 AM ebw  wrote:

> Hi!
>
> I tried to come up with a way to write plugins in go for a C host
> application using -buildmode=c-shared.
>
> My first try failed, because
>
> go build -buildmode=c-shared
>
>
> insisted to resolve all symbols. I thought I could leave some symbols
> unresolved, so they can be later
> resolved, when the shared library is opened by the host application with
> dlopen.
>
> I tweaked the commands in the output of
>
> go build -buildmode=c-shared
>
>
> a bit and now it works.
>
> But I am unsure wether I am headed for a train wreck later. I assume the
> behavior of go build -buildmode=c-shared
> was selected with great care.
>
> I have a complete example at
>
> https://github.com/erwo42/golang-dlopen-plugin
>
> I don't know, how to make such an example work with the playground, so
> please go out of your way and look
> at the repo.
>
> If you see problems with this, please let me know.
>
> Yours sincerely,
>
> Eric Wolf
>

I had been down a similar path where I was trying to port a go library to
C++ via building a c-shared library and then delegating to it from a thin
C++ API. Turned out I hit problems with it in practice, in related to
static thread local storage model, as well as signal handling conflicts in
the host app. I ended up having to ditch it and port to pure C++ so that my
C++ users could use it in a large shared host application (lots of plugins)

> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Using go to write plugins for a C host application

2016-11-13 Thread ebw
Hi!

I tried to come up with a way to write plugins in go for a C host 
application using -buildmode=c-shared.

My first try failed, because

go build -buildmode=c-shared

 
insisted to resolve all symbols. I thought I could leave some symbols 
unresolved, so they can be later
resolved, when the shared library is opened by the host application with 
dlopen.

I tweaked the commands in the output of

go build -buildmode=c-shared


a bit and now it works.

But I am unsure wether I am headed for a train wreck later. I assume the 
behavior of go build -buildmode=c-shared
was selected with great care.

I have a complete example at

https://github.com/erwo42/golang-dlopen-plugin

I don't know, how to make such an example work with the playground, so 
please go out of your way and look
at the repo.

If you see problems with this, please let me know.

Yours sincerely,

Eric Wolf

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.