简体   繁体   English

在C#或Java中使用的C ++ DLL

[英]C++ DLL to be used in C# or Java

I am very new to C++ programming... 我是C ++编程的新手...

I was assigned an assignment to do a SkipList in C++ that will do some functionalities.. Apart from these functionalities, there was also the following included: 我被分配了一个用C ++编写SkipList的功能,该功能将执行某些功能。除了这些功能之外,还包括以下内容:

Export the Skip List to a .DOT file that can be rendered in GraphViz 将跳过列表导出到可以在GraphViz中呈现的.DOT文件

Any ideas how I can do this? 有什么想法可以做到吗? Also, I need to export the DLL so that I can use it in either Java or else in C#.. 另外,我需要导出DLL,以便可以在Java或C#中使用它。

any help is greatly appreciated 任何帮助是极大的赞赏

Thanks 谢谢

If you're looking to use C++ code in Java, check out JNI . 如果要在Java中使用C ++代码,请查看JNI It requires you to modify your C++ code with JNI wrappers (see the Wikipedia link for examples). 它要求您使用JNI包装器修改C ++代码(有关示例,请参阅Wikipedia链接)。

C#, on the other hand, can call DLL functions which are exported normally, ie with extern "C" __declspec(dllexport) , via PInvoke . 另一方面,C#可以调用通过PInvoke正常导出的DLL函数,即使用extern "C" __declspec(dllexport)导出。

The Java has got a JNI technology In fact it's c/c++(with extern "c" calls) library with some specific types and rules Java拥有JNI技术实际上,它是具有某些特定类型和规则的c / c ++(带有外部“ c”调用)库

And yes you can use your dll in Java with some jni bridge 是的,您可以通过一些jni桥在Java中使用dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM