Page 1 of 1

Make LinuxCOM.h compatible with gcc

PostPosted: Thu Feb 27, 2020 10:10 pm
by notnot
I needed to #include <decklink/LinuxCOM.h> in a C file to be compiled with gcc (not C++), in order to make a wrapper
for the Go language, via CGO. Go can call C functions, but not C++.

To accomplish this Go <-> C interoperation, the C code is compiled by gcc, and i got this error:

In file included from /usr/local/include/decklink.h:12:0,
from ./decklink.go:30:
/usr/local/include/decklink/LinuxCOM.h:51:9: error: unknown type name 'REFIID'
typedef REFIID CFUUIDBytes;
^~~~~~

Change line 51 in LinuxCOM.h from

typedef REFIID CFUUIDBytes;

to:

typedef struct REFIID CFUUIDBytes;

and gcc will happily compile it. g++ is fine with it too, this way.


Thanks for the Linux support! I am happily capturing 4K frames :)

Re: Make LinuxCOM.h compatible with gcc

PostPosted: Tue Mar 03, 2020 2:42 am
by Cameron Nichols
Hi Erwin,

Thanks for posting this with workaround.

Out of interest - does your project use mixture of C and C++?

Regards
Cameron

Re: Make LinuxCOM.h compatible with gcc

PostPosted: Wed Mar 04, 2020 1:37 am
by notnot
Hi Cameron,

yes in order to make a package for Go, i had to wrap Decklink API C++ code into a C library which can then be called by the Go runtime. Go cannot call into C++ code directly. My library header file includes LinuxCOM.h, so this is eventually parsed and compiled by a C compiler.