Answered by:

How to transfer a vector object from WinRT DLL back to Windows store app?

Question

I have a WinRT DLL and a windows store app which both written with CPP.

The project is about find all paired bluetooth devices in WinRT DLL （not WinRT Component DLL）, then save them into a vector and transfer it back to the windows store app for display.

The question is: retDeviceInfoVector already got a correct value before return from CBTWinRTDLL::FindPairedDevices(), but in the store app, deviceInfoVector doesn't get anything： (deviceInfoVector = btDLL.FindPairedDevices();)

Answers

FindPairedDevices returns immediately, before the tasks to fill retDeviceInfoVector run. You need to change it to return a task that the caller can trigger and then get the retDeviceInfoVector from the task results when they are complete.