Portable examples?
Posted:
Sat Jul 14, 2018 8:14 am
by ravenheart
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.
Re: Portable examples?
Posted:
Tue Jul 17, 2018 3:46 am
by Cameron Nichols
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
Re: Portable examples?
Posted:
Sun Jul 29, 2018 8:09 am
by ravenheart
Thank you very much, Cameron.
I think this is enough.
Best regards.