简体   繁体   English

使用JNA将c#的字符串转换为Java

[英]convert String of c# to java using JNA

I am using JNA to deal with dll build in C#. 我正在使用JNA处理C#中的dll构建。 I have 我有

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public String serialNumber;

code in dll dll中的代码
How to match serialNumber in java? 如何在java中匹配serialNumber?

Did you try Java's String ? 您尝试过Java的String吗?

It looks like C#'s string is the adequate translation to C's char* , and as Java's string is the adequate translation of C's char* , I would suppose it would work. 看起来C#的string是对C的char*的适当转换,而Java的string是对C的char*的适当转换,我想它会起作用。

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

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