locked
[UWP][C++]Reuse WIN32 DLL in UWP RRS feed

  • Question

  •  Hello.

     My question might be too common but I could not find any clear answer by googling. So I have WIN32 DLL which in turn uses several other libraries and dll.

     I want to connect my dll into UWP application by making WRL WinRT component. What is the best way to do that?

     So far I have tried to recompile my dll with ZW option, but it is not the best choice for me since ZW disables several WIN32 APIs(pipe apis) that I need. Below link speaks about LoadPackagedLibrary, but could not clearly understand how to use that, is it acceptable in my situation?

    https://docs.microsoft.com/en-us/cpp/porting/how-to-use-existing-cpp-code-in-a-universal-windows-platform-app

    Thanks in advance for your response.



    • Edited by miradham Friday, September 1, 2017 7:46 AM add tags
    Friday, September 1, 2017 3:05 AM

Answers

All replies

  • Hello,

    Welcome to the Developing Universal Windows apps forum!

    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools , and don't forget add tag to your question.

    Do you want to upload your app to the Windows Store? If yes then you can not use that dll because of it use not allowed API. If not you can use Brokered WinRT component. As I understand your app is desktop app and if you want upload it to store then you can create standard WPF app consume your dll and upload app to store using desktop Bridge.


    Make the community better together

    • Proposed as answer by Breeze Liu Wednesday, September 13, 2017 9:30 AM
    • Marked as answer by miradham Thursday, December 7, 2017 3:14 AM
    Friday, September 1, 2017 5:40 AM
  •  Thanks for your response.

     I have to connect my DLL with WRL WinRT component APIs, so as per my understanding WPF is not an option here.

     I can try with Brokered component for now. (If my initial understanding is correct final model would look like UWP App -> WRL WinRT -> Brokered component -> WIN32 DLL) Just one clarification before digging deep into Brokered component, is there any limitation to WIN32 DLL  in using MFC or WinSockets? Coz I'd like to include code which uses MFC as well. 

    Sorry if my questions are too basic, Iam not much experienced in win programming.

     

    Friday, September 1, 2017 9:18 AM
  • Hi miradham,

    >> is there any limitation to WIN32 DLL  in using MFC or WinSockets?

    We can use part of the Win32 and COM APIs in UWP app, please reference the Win32 and COM APIs for UWP apps document and find whether the API can be used in UWP apps.

    As for the Brokered component, it is an enterprise-targeted feature supported by Windows 10, which allows touch-friendly .NET apps to use the existing code responsible for key business-critical operations. See the document:

    https://docs.microsoft.com/en-us/windows/uwp/winrt-components/brokered-windows-runtime-components-for-side-loaded-windows-store-apps

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by miradham Thursday, December 7, 2017 3:13 AM
    Tuesday, September 5, 2017 8:21 AM