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: 10
  • 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: 442
  • 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: 10
  • 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.
Offline

danjenkins

  • Posts: 1
  • Joined: Tue Jan 10, 2023 1:34 pm
  • Location: Dover, UK
  • Real Name: Dan Jenkins

Re: Make LinuxCOM.h compatible with gcc

PostTue Jan 10, 2023 1:35 pm

Hey notnot,

Any chance of sharing your golang wrapper?

EDIT - This post needed to wait for approval - sorted now.

Dan

Return to Software Developers

Who is online

Users browsing this forum: TBTech and 14 guests