Portable examples?

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

ravenheart

  • Posts: 2
  • Joined: Sat Jul 14, 2018 8:08 am
  • Real Name: Pere Calpe

Portable examples?

PostSat Jul 14, 2018 8:14 am

I just downloaded the Blackmagic Decklink SDK. However, the include files and the examples are separated in "Linux", "Windows" and "Mac" categories.

Besides, the Windows "include" files are idl (non-portable microsoft headers for COM, instead of C++ include files).

Is there an example or a recommended way to develop a multiplatform application? I need to support at least Windows and Linux.

Thank you.
Offline

Cameron Nichols

Blackmagic Design

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

Re: Portable examples?

PostTue Jul 17, 2018 3:46 am

Hi Pere,

Have a look at the code samples in the Examples directory for full cross-platform samples. In addition the ClosedCaptions and DeviceConfigure samples have a similar codebase, differing only by platform specific code.

A few pointers from cross-platform development:
  • If you are using Visual Studio, by default the MIDL compiler is configured to output header as DeckLinkAPI_h.h, change this to output DeckLinkAPI.h
  • Use _WIN32, __APPLE__ and __linux__ pragmas for platform specific code
  • Win32 variant needs to call CoInitialize/CoUninitialize for COM
  • Include <stdint.h> in Win32 variant to use uint32_t, int64_t, etc
  • Win32 headers uses BOOL, macOS/Linux use C++ bool. Keep this in mind when calling functions that output boolean such as GetFlags().
  • For strings, Win32 uses BSTR, Linux: const char*, macOS: CFStringRef. In the DeviceConfigure sample, platform.h includes helper functions to convert to std::string
I hope this helps

Kind Regards
Cameron
Offline

ravenheart

  • Posts: 2
  • Joined: Sat Jul 14, 2018 8:08 am
  • Real Name: Pere Calpe

Re: Portable examples?

PostSun Jul 29, 2018 8:09 am

Thank you very much, Cameron.

I think this is enough.

Best regards.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests