What will the best way to pass a datatable data to unmanaged environments? (c++)
Ofer
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think there is a single best answer here.
One option is to export the database as XML and let your unmanaged code consume that. The main benefit of this approach is it is cheaper (development-wise) on the managed side and provides flexibility on the unmanaged side.
Otherwise you will need to provide your own marshaling of the data. This would be best down with C++/CLI code that could work with the dataset and convert it to a data structure that your unmanaged code understands.
We’ve done something similar in the past and it works, but is a fair amount of code to cover the general case.