How to call BMDSwitcherAPI in a Qt project?

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

fmjsky

  • Posts: 3
  • Joined: Fri Mar 19, 2021 2:37 pm
  • Real Name: Mengjun Fang

How to call BMDSwitcherAPI in a Qt project?

PostThu Mar 25, 2021 5:27 am

Dear software engineer
I am not a software developer. I taught myself a little about Qt programming.
I want to use Qt to write an ATEM control program that contains special functions (triggering other hardware device functions).

Platform:Windows 10
Qt Version:Qt5.9.9
However, I don't know how to call API in Qt.
I haved use dumpcpp to create “bmdswitcherapi.h” and “bmdswitchapi.cpp”. but it does't work.

Platform:mac os 10.14.6
Qt Version:Qt5.9.9
Xcode:10.3
error:
symbol(s) not found for architecture x86_64
linker command failed with exit code 1(use -v to see invocation)

best regards
Offline

Cameron Nichols

Blackmagic Design

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

Re: How to call BMDSwitcherAPI in a Qt project?

PostFri Mar 26, 2021 2:48 am

Hi,

You need to first invoke midl compiler on BMDSwitcherAPI.idl to generate necessary headers/sources. You should add the following to your .pro file:
Code: Select all
win32 {
        MIDL_FILES = "../../include/BMDSwitcherAPI.idl"

        MIDL.name = Compiling IDL
        MIDL.input = MIDL_FILES
        MIDL.output = ${QMAKE_FILE_BASE}.h
        MIDL.variable_out = HEADERS
        MIDL_CONFIG += no_link
        contains(QMAKE_TARGET.arch, x86_64)   {
                MIDL.commands = midl.exe /env win64 /h ${QMAKE_FILE_BASE}.h /W1 /char signed /D "NDEBUG" /robust /nologo ${QMAKE_FILE_IN}
        } else {
                MIDL.commands = midl.exe /env win32 /h ${QMAKE_FILE_BASE}.h /W1 /char signed /D "NDEBUG" /robust /nologo ${QMAKE_FILE_IN}
        }
        QMAKE_EXTRA_COMPILERS += MIDL
}

Here I am assuming that your .pro is is a folder under Window/Samples path, you should adjust the MIDL_FILES path if required. Please remember to also add this to your include path:
Code: Select all
INCLUDEPATH += ../../include

On the macOS question, ensure that you are adding BMDSwitcherAPIDispatch.cpp to your sources:
Code: Select all
macx:SOURCES += ../../include/BMDSwitcherAPIDispatch.cpp

Regards
Cameron
Offline

fmjsky

  • Posts: 3
  • Joined: Fri Mar 19, 2021 2:37 pm
  • Real Name: Mengjun Fang

Re: How to call BMDSwitcherAPI in a Qt project?

PostFri Mar 26, 2021 1:58 pm

Dear Cameron Nichols

According to the methods that you provided,I had do some test. but it still does't work.

MAC OS:
Image

WIN10:
there is no Headfile be generated.

Image

Image

Image





Cameron Nichols wrote:Hi,

You need to first invoke midl compiler on BMDSwitcherAPI.idl to generate necessary headers/sources. You should add the following to your .pro file:
Code: Select all
win32 {
        MIDL_FILES = "../../include/BMDSwitcherAPI.idl"

        MIDL.name = Compiling IDL
        MIDL.input = MIDL_FILES
        MIDL.output = ${QMAKE_FILE_BASE}.h
        MIDL.variable_out = HEADERS
        MIDL_CONFIG += no_link
        contains(QMAKE_TARGET.arch, x86_64)   {
                MIDL.commands = midl.exe /env win64 /h ${QMAKE_FILE_BASE}.h /W1 /char signed /D "NDEBUG" /robust /nologo ${QMAKE_FILE_IN}
        } else {
                MIDL.commands = midl.exe /env win32 /h ${QMAKE_FILE_BASE}.h /W1 /char signed /D "NDEBUG" /robust /nologo ${QMAKE_FILE_IN}
        }
        QMAKE_EXTRA_COMPILERS += MIDL
}

Here I am assuming that your .pro is is a folder under Window/Samples path, you should adjust the MIDL_FILES path if required. Please remember to also add this to your include path:
Code: Select all
INCLUDEPATH += ../../include

On the macOS question, ensure that you are adding BMDSwitcherAPIDispatch.cpp to your sources:
Code: Select all
macx:SOURCES += ../../include/BMDSwitcherAPIDispatch.cpp

Regards
Cameron
Offline

fmjsky

  • Posts: 3
  • Joined: Fri Mar 19, 2021 2:37 pm
  • Real Name: Mengjun Fang

Re: How to call BMDSwitcherAPI in a Qt project?

PostFri Mar 26, 2021 2:47 pm

MACOS:
MAC1.png
MAC1.png (206.82 KiB) Viewed 143 times


WIN10:
WIN1.png
WIN1.png (72.83 KiB) Viewed 143 times

WIN3.png
WIN3.png (6.4 KiB) Viewed 143 times

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 4 guests