Search Unity

UWP and native DLLs

Discussion in 'Windows' started by dave_m_moore, May 23, 2023.

  1. dave_m_moore

    dave_m_moore

    Joined:
    Jul 28, 2016
    Posts:
    39
    Hi All,
    Is it possible to access native Windows DLLs from a UWP Unity Built application? Am trying to access windowing functions from user32.dll, but it seems to crash on execution of any functions.

    I have successfully accessed self-built c++ native libraries from Standalone Unity builds and this was fine.

    Thanks for any pointers,
    Dave
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,892
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    You are not allowed to call into system DLLs via DllImport mechanism on UWP. You can only call into libraries you bundle with the application yourself. You can only call into system libraries from native C++ code.

    Also, functionality in user32.dll is not available to UWP applications, even if you write C++ code to call into them.
     
    CodeSmile likes this.
  4. dave_m_moore

    dave_m_moore

    Joined:
    Jul 28, 2016
    Posts:
    39
    Thanks for this response - this explains the behavior I was seeing.