Re: [go-nuts] Re: Creating and Accessing DLL methods in GO

2022-10-05 Thread Brian Candler
On Tuesday, 4 October 2022 at 05:47:49 UTC+1 squadglad...@gmail.com wrote: > We have some disk space restrictions and hence we do not want to include > the common code as a library in the service. That will increase the size of > each exe. We would like to keep the common code and service code

Re: [go-nuts] Re: Creating and Accessing DLL methods in GO

2022-10-04 Thread Jason E. Aten
@squadglad, it is certainly possible to compile go code into a windows DLL, and to use cgo. I've done it successfully. You'll want to study up on cgo. There are strict rules for keeping go pointers and C pointers apart, and they can be subtle. You'll need to be become well versed in the details

Re: [go-nuts] Re: Creating and Accessing DLL methods in GO

2022-10-03 Thread Gladiators Squad
We have some disk space restrictions and hence we do not want to include the common code as a library in the service. That will increase the size of each exe. We would like to keep the common code and service code independent of each other. Changes in one should not affect or cause recompilation

Re: [go-nuts] Re: Creating and Accessing DLL methods in GO

2022-10-03 Thread Brian Candler
On Monday, 3 October 2022 at 10:40:06 UTC+1 squadglad...@gmail.com wrote: > We are trying to use a common code as a DLL which is shared by multiple > services. > You've mixed a problem and solution statement together. You want to share code between multiple services: if so, there are other

Re: [go-nuts] Re: Creating and Accessing DLL methods in GO

2022-10-03 Thread Gladiators Squad
We are trying to use a common code as a DLL which is shared by multiple services. The services need to support multiple platforms like Linux((amd64 and Armv7), Windows and FreeBSD. and we are using the following command to generate the DLL go build -buildmode=c-shared -o calc.so calc.go -- linux

[go-nuts] Re: Creating and Accessing DLL methods in GO

2022-09-30 Thread Brian Candler
> is go-plugin supported by Windows? If you mean go's own plugin system, then no: https://pkg.go.dev/plugin (sorry, I should have remembered that) If you mean the go-plugin library from Hashicorp: I believe it should be fine. It's used by Hashicorp Vault, and Vault supports Windows:

[go-nuts] Re: Creating and Accessing DLL methods in GO

2022-09-29 Thread Gladiators Squad
is go-plugin supported by Windows?...We want to create go dll and tey to access through go code On Thursday, September 29, 2022 at 5:12:34 PM UTC+5:30 Brian Candler wrote: > My first reaction is, do you *really* want to call a Go DLL from a Go main > program? It seems to me like you will have

[go-nuts] Re: Creating and Accessing DLL methods in GO

2022-09-29 Thread Brian Candler
My first reaction is, do you *really* want to call a Go DLL from a Go main program? It seems to me like you will have two active copies of the Go runtime with their own garbage collectors etc. Go "plugins" might be closer to what you need:

[go-nuts] Re: Creating and Accessing DLL methods in GO

2022-09-29 Thread Peter Galbavy
Oh, hang on, please ignore my last message. It's that was because the *caller* was defined that way - it's NOT a Go thing. Oops, my bad. Peter On Thursday, 29 September 2022 at 10:33:23 UTC+1 Peter Galbavy wrote: > On Linux at least - I have not tried building or using a Windows DLL, you >

[go-nuts] Re: Creating and Accessing DLL methods in GO

2022-09-29 Thread Peter Galbavy
On Linux at least - I have not tried building or using a Windows DLL, you have to accept C-style args and process them in the exported function signature: e.g. //export SendMail func SendMail(n C.int, args **C.char) C.int { conf := parseArgs(n, args) ... Here my parseArgs() func loops