函数原型如下:
public virtual int Base64Decode(ref short @in, ref short @out, short len);要在c#中调用 in传进去的应该是byte[]或者string,
out传出的也应该是byte[]或者string
但是short @in我真的不知道什么意思,应该怎样传参数,第一次接触c# 求教
public virtual int Base64Decode(ref short @in, ref short @out, short len);要在c#中调用 in传进去的应该是byte[]或者string,
out传出的也应该是byte[]或者string
但是short @in我真的不知道什么意思,应该怎样传参数,第一次接触c# 求教
不过LZ你这
public virtual int Base64Decode(ref short @in, ref short @out, short len);
是C#吧,和C++有什么关系?
public virtual int Base64Decode(ref short @in, ref short @out, short len);
这里怎么把一个数组传进去
Base64Encode(ref inarr[0], ref outarr[0], (short)inarr.Length)
的话会报错
你C++的函数是什么样的啊?
功能简介 用于将数据进行Base64 解码码
参数说明 In :输入数据(文本)
Out:输出数据(二进制)
Len:输入数据长度.
原型是这样的
// long Base64Decode(short * in, short * out, short len);
[DllImport("xxxx.dll", CallingConvention = CallingConvention.StdCall)]
public static extern long Base64Decode(IntPtr in, IntPtr out, short len);
// 把 API 定义成 C# 识别的接口其次:
在使用原 C++ short* in 的 in变量自己需要定义一个 short[] _in 变量, 并new 出len 那么多
例如 short[] _in = new short[32];
准备好里面的数据
然后
IntPtr in_todll = GCHandle.ToIntPtr(_in);
同理,out 也一样
传进去即可
注意取 out 时用 Marshal.PtrToStructure() 前面强转成 C# 定义好的 out 类型。
(利奥)
你好 我标题着急写错了
应该是c++ activex控件
控件引用后 函数原型直接就给生成好了的
就是 函数原型如下:
public virtual int Base64Decode(ref short @in, ref short @out, short len);这样的话 有办法做吗
我想应该类似吧,你查一下 C# 对 @in 这种参数的定义,搜索一下应该可以找到答案的。