Jump to content
  • Advertisement
DividedByZero

C++ Choosing DLL to use depending on OS version

Recommended Posts

Hi Guys,

I have a scenario where I am trying to call a function from a DLL but the problem is Microsoft has put the function in different DLL's depending on what OS is used.

'MFCreateDXGIDeviceManager' is in mshtmlmedia.dll in Windows 7 and Vista but is in mfplat.dll in Windows 8 and above.

I can figure out easily enough what OS my application is running on, but I don't know how to tell it to reference the correct DLL given the OS.

Is there a way to choose the correct DLL at run-time?

This one has had me stumped for several years now, but the time has come where I have to revisit the problem. In this occasion having two separate exe's (i.e. a Win 7 and Win 8+) is not really an option unfortunately.

Many thanks in advance. :)

 

Share this post


Link to post
Share on other sites
Advertisement

This is the problem with using unsupported functionality. MFCreateDXGIDeviceManager is supported in Win8+, and not really guaranteed to even remain exposed in the DLL you're using it from in Win7.

If you do indeed want to use it, then yes, LoadLibrary()/GetProcAddress() is the way to do it. I would suggest finding a different way of solving the problem you're trying to solve if you indeed want to support Win7 though.

Share this post


Link to post
Share on other sites

If you look at the documentation it mentions that the minimum client support is windows 8 which means you should not be using this in Windows 7 at all.

Besides writing your own device manager is not that hard and requires about 100 lines of code.

Edited by NightCreature83

Share this post


Link to post
Share on other sites

Thanks for the replies guys, I will take this all on board.

 

7 minutes ago, NightCreature83 said:

If you look at the documentation it mentions that the minimum client support is windows 8 which means you should not be using this in Windows 7 at all.

Besides writing your own device manager is not that hard and requires about 100 lines of code.

Any hints on where I would start with such a task? 

I have googled it but it keeps bouncing me back to the unsupported IMFDXGIDeviceManager.

Essentially, if I can figure out how to get the pointer to the video texture using MMF then I'd have no problems sorting out the locking / unlocking of the memory etc.

Thanks again.

Share this post


Link to post
Share on other sites
1 hour ago, NightCreature83 said:

Why are you using MMF where you really want to use DirectX?

Not sure how you have come to this conclusion.

DirectX has no knowledge of video codecs, audio codecs, frame decompression, etc...

Share this post


Link to post
Share on other sites
45 minutes ago, DividedByZero said:

Not sure how you have come to this conclusion.

DirectX has no knowledge of video codecs, audio codecs, frame decompression, etc...

Well this is the first time you mention you need the codecs in this thread so I could not have guessed that, this is gamedevelopment after all and in most cases you would just need the D3D api.

You are using the wrong sections out of the Media Foundation library to support windows 7. And if you are not developing a store app, you can just use the windows 7 api on win 8 and 10.

 

Share this post


Link to post
Share on other sites
1 hour ago, DividedByZero said:

Not sure how you have come to this conclusion.

DirectX has no knowledge of video codecs, audio codecs, frame decompression, etc...

What are you trying to do? I have done quite a bunch of video-related stuff recently, and may be able to help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!