How to use Cgo with typedefs?

blov · · 338 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello, I am creating a project which uses cryptography that I coded in C due to existing libraries and speed. When attempting to interface with Cgo, I am having some trouble with typedefs I created in C. One example is below:</p> <pre><code>typedef unsigned char ec_point[32]; </code></pre> <p>I am able to successfully create ec_point variables, and use functions that take in ec_point*. However, whenever I attempt to use functions that are passed with a normal ec_point, I get the error:</p> <pre><code>cannot use pk2 (type C.ec_scalar) as type *C.uchar in argument to _Cfunc_secret_to_public </code></pre> <p>I can&#39;t seem to find a way where I can easily convert this too. I also don&#39;t want to have to refactor my code to take in ec_point*, as ec_point is already a pointer (since it is an array of 32 char)</p>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

338 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传