参数整数没有问题,但是如果是字符串,要注意几个细节。

记录如下:

1.Delphi定义函数的时候,字符串参数需要使用PChar类型

2.Go传递参数的时候要将字符串转成UTF16的指针,接收的时候采用uint16的切片。

     dll := syscall.MustLoadDLL("Encryptdll.dll")
defer syscall.FreeLibrary(dll.Handle)
f1 := dll.MustFindProc("test06")
fmt.Println("f1>>>>", f1) p1, _ := syscall.UTF16PtrFromString("sql")
p2 := make([]uint16, ) // pass word limited length! syscall.MAX_PATH r1, r2, err := f1.Call(uintptr(unsafe.Pointer(p1)), uintptr(unsafe.Pointer(&p2)))
if err != nil {
fmt.Println(r1, r2, p1, p2, err.Error(), syscall.UTF16ToString(p2))
}

最新文章

  1. B样条基函数(cubic spline basis)
  2. sql 优化 链接提示 查询提示 标提示
  3. Nodejs学习笔记(一)——初识Nodejs
  4. ORACLE ORA-01157: 无法标识/锁定数据文件
  5. 关于IE9中webdiriver使用autoit上传文件报错
  6. [LeetCode]题解(python):116 Populating Next Right Pointers in Each Node
  7. 《Java中的单例模式--两种》
  8. PNG图片压缩工具
  9. [树莓派]安装node环境
  10. oracle 清除当前用户的回收站
  11. PHP高级笔记汇总
  12. Spark编程进阶
  13. JavaSE(十一)之异常处理详解
  14. Lucene入门简介
  15. 原生JS封装 toast 弹层,自动关闭
  16. intellij idea 汉化
  17. 集合之LinkedHashMap(含JDK1.8源码分析)
  18. Windows两个网卡配置路由规则 同时访问内网和外网
  19. 问题 Duplicate entry '0' for key 'PRIMARY'
  20. Vim中自动在程序起始处添加版权和作者信息

热门文章

  1. 单点登录的实践demo
  2. Linux执行shell脚本的方法
  3. SDOI2019快速查询
  4. SP5971 LCMSUM 数论
  5. Vue与REACT两个框架的区别和优势对比
  6. Python中近期Pandas使用总结
  7. Eclipse4.9集成Tomcat 9.0.21详细版
  8. enable device: BAR 0 [mem 0x00000000-0x003fffff] not claimed
  9. Matlab Script to pre-process UAV123 tracking dataset
  10. BGP MPLS IP V匹N基本概念