{"id":316550,"date":"2021-02-04T05:07:25","date_gmt":"2021-02-03T21:07:25","guid":{"rendered":"http:\/\/4563.org\/?p=316550"},"modified":"2021-02-04T05:07:25","modified_gmt":"2021-02-03T21:07:25","slug":"golang-%e8%b0%83%e7%94%a8-c-dll-%e5%a6%82%e4%bd%95%e5%8f%96%e5%be%97%e8%bf%94%e5%9b%9e%e5%80%bc","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=316550","title":{"rendered":"golang \u8c03\u7528 c++ dll \u5982\u4f55\u53d6\u5f97\u8fd4\u56de\u503c"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  golang \u8c03\u7528 c++ dll \u5982\u4f55\u53d6\u5f97\u8fd4\u56de\u503c               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : i4color <\/span>  <span><i><\/i> 7<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4ee5\u4e0b\u662f c++\u7684\u65b9\u6cd5\uff0c\u5176\u4e2d iResult \u662f\u53ef\u4ee5\u8fd4\u56de\u7684\uff0c\u6211\u8be5\u5982\u4f55\u4f20\u5165\u548c\u53d6\u51fa\uff1f CreateITapTradeAPI(const ITapTrade::TapAPIApplicationInfo *appInfo, ITapTrade::TAPIINT32 &amp;iResult);<\/p>\n<p>\u6211\u73b0\u5728\u7684\u5199\u6cd5\uff1a vref2 := 0 var ref2 = uintptr(unsafe.Pointer(&amp;vref2) ret, b, err := funcresult.Call(ref1, ref2)<\/p>\n<p>\u6ca1\u6709\u62a5\u9519\uff0c\u4f46\u4e0d\u77e5\u9053\u5982\u4f55\u53d6\u5f97 \u4f20\u51fa\u7684\u503c<\/p>\n<p>\u8fd9\u6837\u8bd5\u8fc7\uff0c\u597d\u50cf\u4e0d\u5bf9 presult := (*byte)(unsafe.Pointer(ref2)) if (presult != nil) { data := make([]byte, 0)<\/p>\n<p>for *presult != 0 { data = append(data, *presult) ref2 += unsafe.Sizeof(byte(0)) presult = (*byte)(unsafe.Pointer(ref2))<\/p>\n<p>resultcode := binary.BigEndian.Uint32(data) \/\/bytesBuffer := bytes.NewBuffer(data) \/\/var tmp int32 \/\/binary.Read(bytesBuffer, binary.BigEndian, &amp;tmp) println(resultcode) }<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5094062\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysc3839 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             C++ \u7684\u5bfc\u51fa\u51fd\u6570\u4e00\u822c\u4e0d\u80fd\u8de8\u8bed\u8a00\u8c03\u7528\u5427\uff0c\u8981\u8c03\u7528\u7684\u8bdd\u9700\u8981\u5305\u88c5\u6210 C \u7684\u51fd\u6570\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5094063\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dswyzx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c golang \u4e0d\u652f\u6301\uff0c\u90a3\u4e48\u5199\u4e2a c#\u8c03\u7528\u7136\u540e\u66b4\u9732\u6210 webapi \uff1f\u66f2\u7ebf\u6551\u56fd                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5094064\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : i4color <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ysc3839 \u53ef\u4ee5\u7684\u3002\u6211\u8bd5\u4e86\u53e6\u4e00\u4e2a\u65e0\u53c2\u6570\u7684\uff0c\u5c31\u53ef\u4ee5\u53d6\u5f97\u8fd4\u56de\u503c\uff0c\u53ea\u4e0d\u8fc7\u4ed6\u4e0d\u662f\u5f15\u7528\u53c2\u6570                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5094065\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : i4color <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u4e86\uff0c\u53d6\u9519\u503c\u4e86\uff0c\u5b83\u76f4\u63a5\u628a vref2 \u8fd9\u4e2a\u53d8\u91cf\u6539\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5094066\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hotsymbol <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b98\u65b9\u5c31\u6709\u6587\u6863\uff0chttps:\/\/github.com\/golang\/go\/wiki\/WindowsDLLs                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>golang \u8c03\u7528 c++ dll&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316550"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316550"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316550\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316550"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}