Make LinuxCOM.h compatible with gcc

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

notnot

  • Posts: 9
  • Joined: Sat Jan 04, 2014 11:27 pm
  • Location: Amsterdam
  • Real Name: Erwin Driessens

Make LinuxCOM.h compatible with gcc

PostThu Feb 27, 2020 10:10 pm

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 :)
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 253
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Make LinuxCOM.h compatible with gcc

PostTue Mar 03, 2020 2:42 am

Hi Erwin,

Thanks for posting this with workaround.

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

Regards
Cameron
Offline

notnot

  • Posts: 9
  • Joined: Sat Jan 04, 2014 11:27 pm
  • Location: Amsterdam
  • Real Name: Erwin Driessens

Re: Make LinuxCOM.h compatible with gcc

PostWed Mar 04, 2020 1:37 am

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.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 9 guests