Return of vector from dll to XAMl

Posted by Vaibhav7676 under C# on 5/20/2015 | Points: 10 | Views : 892 | Status : [Member] | Replies : 1
I have a function which i am calling on button click in XAML
which will further call dll code(cpp). first it was void function now i have made it to.
DLL Vector<String^>^ ScanAvailableDeviceAsync()
Vector<String^>^ devi;
return devi;
but i am unable to return the value it throws some errror

ERROR:

1> dllmain.cpp
1>dllmain.cpp(18): warning C4447: 'main' signature found without threading model. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
1> FindMeAppDll.cpp
1>c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58): error C2143: syntax error : missing ';' before '<'
1>c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>FindMeAppDll.cpp(25): error C2872: 'Vector' : ambiguous symbol
1> could be 'c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58) : int Vector'
1> or 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\collection.h(536) : Platform::Collections::Vector'
1>FindMeAppDll.cpp(25): error C2061: syntax error : identifier 'Vector'
1>FindMeAppDll.cpp(26): error C2872: 'Vector' : ambiguous symbol
1> could be 'c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58) : int Vector'
1> or 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\collection.h(536) : Platform::Collections::Vector'
1>FindMeAppDll.cpp(26): error C2061: syntax error : identifier 'Vector'
1>FindMeAppDll.cpp(267): error C2872: 'Vector' : ambiguous symbol
1> could be 'c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58) : int Vector'
1> or 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\collection.h(536) : Platform::Collections::Vector'
1>FindMeAppDll.cpp(267): error C2143: syntax error : missing ';' before '<'
1>FindMeAppDll.cpp(267): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>FindMeAppDll.cpp(267): error C2086: 'int Vector' : redefinition
1> c:\users\administrator\desktop\findmeapp\findmedll_code\findmelocator\findmelocator\FindMeAppDll.h(58) : see declaration of 'Vector'
1>FindMeAppDll.cpp(268): error C2143: syntax error : missing ';' before '{'
1>FindMeAppDll.cpp(268): error C2447: '{' : missing function header (old-style formal list?)
1> FindMeLocator.cpp




Responses

Posted by: Rajnilari2015 on: 9/28/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
You need to create your own C++/CLI interop to achieve this. Please read more about the discussion http://stackoverflow.com/questions/16864050/how-to-call-c-function-takes-vector-call-from-c-sharp

--
Thanks & Regards,
RNA Team

Vaibhav7676, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response