I’m writting a C++ wrapper.
Think about the next venture:src.cpp
#embrace "src.h"
struct SourceType {
int foo;
};
src.h
:
struct SourceType;
c.h
is a C wrapper of this C++ code:
typedef struct SourceType SourceType;
struct SourceType;
wrapper.h
is a wrapper for GO:
#pragma as soon as
#embrace "c.h"
fundamental.go
:
package deal fundamental
/*
#embrace "wrapper.h"
*/
import "C"
func fundamental() {
var foo C.SourceType
_ = foo
}
I’m getting the next error:
# instance.com
./fundamental.go:9:6: _Ctype_struct_SourceType is incomplete (or unallocatable); stack allocation disallowed
here’s a repo: GitHub – gucio321/cpp-wrapper-demo
oh, okay, obtained it. I can’t allocate this object, I must allocate a pointer
Hello @gucio321,
I’m operating up in opposition to the very same concern doing a go-binding to a c/c++ venture. Might you please inform me what you imply by, ” I can’t allocate this object, I must allocate a pointer.”? I wish to discover ways to remedy this for my venture as effectively. Thanks!
By no means thoughts. I perceive your remark and was in a position to make the identical modifications.