LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Call Library Function to call Windows Media Foundation libraries

I am trying to use Call Library Function to call some functions related to Windows Media Foundation with some level of success. But it is not as easy as it seems...

Now what I need to do is to call MFCreateMediaSession (MFCreateMediaSession function (mfidl.h) - Win32 apps | Microsoft Learn😞


HRESULT MFCreateMediaSession( IMFAttributes *pConfiguration, IMFMediaSession **ppMediaSession )
;

pConfiguration will be NULL so, fine, but ppMediaSession would become a pointer to the IMFMediaSession interface.

This is where I hit a snag. I don't know how to handle a pointer to an interface in LabVIEW or how I can call functions in the interface via that pointer.

Can I really continue down this route and if it's possible to do something about it then how should I proceed?

Below is the code snippet:

MFCreateMediaSession.png

0 Kudos
Message 1 of 4
(592 Views)

Configure the second parameter as a pointer sized integer and then pass by pointer. You then have to remember that the LabVIEW value is a pointer in the rest of your application.

 

snip.png

 

For system libraries, you do not need to specify the DLL path. It is enough to give just the library name.

 

If you know how to call a C++ class method from LabVIEW (I don't), you can proceed.

Otherwise you could write a wrapper DLL that exposes the class methods you need via a C interface. Depending on what you want to do, you could offload a lot more to the wrapper.

0 Kudos
Message 2 of 4
(544 Views)

C++ class methods and properties can’t be accessed through the LabVIEW Call Library Node for several reason. One of them also is that different C++ compilers create different binary interfaces for that, so there is not one single way to do it.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 4
(506 Views)

At this rate I will just build a .NET wrapper library to cure my insanity. Thanks both of you for your explanation anyhow 🙂

0 Kudos
Message 4 of 4
(490 Views)