I am trying to create a generic function which returns
a Container with a slice of the specified type T:
https://go.dev/play/p/GS_x9Y8HOMK
Is this not supported or am I doing something wrong ?
Regards.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" gr
--
So the user build the library for different backends:
>go install -tags backend1
or
>go install -tags backend2
On Monday, November 1, 2021 at 5:13:14 PM UTC-3 Ian Lance Taylor wrote:
> On Sun, Oct 31, 2021 at 10:17 AM Elemer Pixard wrote:
> >
> > I am developing a
I am developing a binding to a C++ library
using a wrapper module (using extern "C" directive).
The C++ library files are in a subdirectory of the package.
If I create a file in the package directory such as:
lib.cpp
--
#include "cpplib/file.cpp"
#include "cpplib/wrapper.cpp"
This should be possible, because the slice simply contains the address of
the function.
Why the compiler cares what the function will be doing when called ?
Equivalent code will work in several other languages.
On Friday, October 22, 2021 at 2:59:36 PM UTC-3 Jan Mercl wrote:
> testSlice mentions
Using unsafe.Pointer instead of the C type: C.device_t solved the problem:
func Open() {
var dev unsafe.Pointer
C.open(&dev)
}
On Saturday, September 25, 2021 at 12:13:04 PM UTC-3 Elemer Pixard wrote:
> Correction: The Go function is:
> func Open() {
> var dev *C.device
Correction: The Go function is:
func Open() {
var dev *C.device_t
C.open(&dev)
}
On Saturday, September 25, 2021 at 10:59:45 AM UTC-3 Elemer Pixard wrote:
> I am trying to call the following C function (simplified version from a C
> library) from Go,
> and I got compiler erro
I am trying to call the following C function (simplified version from a C
library) from Go,
and I got compiler errors:
typedef void device_t;
void open(device_t **dev) {
}
*Go Function*:
func Open() {
var dev C.device_t
C.open(&&dev)
}
*Compiler (v1.17) error:*
cannot use _cgo0 (type **_Ct
Hi,
The recommended way to call a Javascript function through syscall/js seems
to be:
doc := js.Global().Get("document")
div := doc.Call("createElement", "div")
Why is not possible to cache the Javascript function reference like this:
doc := js.Global().Get("document")
createElement := doc.G