在 C# 中创建一个 STL std::set 并封送至 c++
实现这一目标的最佳方法是什么?我有一个文件名列表,是在 C# Windows 服务中生成的。我最终需要将它们放入 STL 集中,并将其推送到文件映射。我假设实际上在 C# 中创建这个结构要么是被禁止的,要么就是太困难而不值得,但是我可以使用一个本机 dll 返回一个指向它创建的集合的指针,然后在文件映射中传递该指针吗?这里的任何想法都会有帮助!
What would be the best way to achieve this? I've got a list of filenames, generated in a C# windows service. I need to ultimately get them into an STL set, and push that to a filemapping. I assume actually creating this structure in C# is either prohibited, or just too difficult to be worthwhile, but could I use a native dll that returns a pointer to the set it created, that I then pass along in the filemapping? Any thoughts here would be helpful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 C# 中创建
std::set
并不实际。然而,可以通过 PInvoke 将名称集合传递到 C 中,并将它们放入其中的std::set
中。然后,您可以使用 PInvoke 从 C# 调用此函数,从而将数据传递到本机
Creating a
std::set
in C# is not really practical. However it is possible to communicate the collection of names into C via PInvoke and put them into anstd::set
there.Then you could call this function from C# using PInvoke and hence pass of the data to native