Reputation: 781
I'am making some uwp app on ARM device(IotCore), and I want use some legacy native dll in uwp app by p/inbvoke.
How can I build this dll project as ARM arch with visual studio 2015?
This is my code, and it works well on my x64 dev machine(win10x64).
This is native dll code :
#ifdef MYSIMPLENATIVEDLL_EXPORTS
#define MYSIMPLENATIVEDLL_API extern "C" __declspec(dllexport)
#else
#define MYSIMPLENATIVEDLL_API extern "C" __declspec(dllimport)
#endif
MYSIMPLENATIVEDLL_API int Add(int x, int y);
MYSIMPLENATIVEDLL_API int Add(int x, int y)
{
return x + y;
}
This is uwp app code :
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var result = Add(1, 2);
var dlg = new MessageDialog($"result : {result}");
await dlg.ShowAsync();
}
[DllImport("MySimpleNativeDll")]
static extern int Add(int x, int y);
}
full source code : https://github.com/HyundongHwang/MyNativeDllUwpIntegApp
Upvotes: 0
Views: 1294
Reputation: 2907
When creating the project for the DLL, you need to target "Windows Universal" instead of "Win32". Such DLL project will have an ARM platform in the platform drop down (like you now have Win32 and x64 there).
Upvotes: 1