{"id":1177,"date":"2014-01-22T17:21:49","date_gmt":"2014-01-22T09:21:49","guid":{"rendered":"http:\/\/www.dogeye.net\/?p=1177"},"modified":"2014-01-22T17:21:49","modified_gmt":"2014-01-22T09:21:49","slug":"%e8%bf%90%e8%a1%8cloadlib%e6%8f%90%e7%a4%baattempt-to-call-global-loadlib-a-nil-value","status":"publish","type":"post","link":"https:\/\/ykyi.net\/?p=1177","title":{"rendered":"\u8fd0\u884cloadlib()\u63d0\u793aattempt to call global &#8216;loadlib&#8217; (a nil value)"},"content":{"rendered":"<p>2009\u5e74\u7684\u65f6\u5019\u7528\u8fc7lua\uff0c\u5f53\u65f6\u5728windows\u4e0a\u5199\u91d1\u5c71\u6025\u6551\u7bb1\u7684\u6076\u610f\u8f6f\u4ef6\u5e93\u5f15\u64ce\u3002<\/p>\n<p>\u65f6\u9694\u591a\u5e74\uff0c\u53c8\u8981\u73a9\u4e00\u628alua. \u91cd\u62felua\uff0c\u5728lua\u63a7\u5236\u53f0\u7528loadlib\u8f7d\u5165\u52a8\u6001\u94fe\u63a5\u5e93\u65f6\u51fa\u9519\uff1a<\/p>\n<pre class=\"brush:other\">&gt; loadlib(&quot;libhello.so&quot;, &quot;*&quot;)\nstdin:1: attempt to call global &#39;loadlib&#39; (a nil value)\nstack traceback:\n    stdin:1: in main chunk\n    [C]: in ?<\/pre>\n<p>Lua\u8868\u793a\u5728\u5168\u5c40\u57df\u4e2d\u6ca1\u6709loadlib\u3002google\u540e\u53d1\u73b0\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>\u7b2c\u4e00\u79cd\u8ba4\u4e3a\u8fd9\u79cd\u9519\u8bef\u662f\u56e0\u4e3a\u6ca1\u6709\u628aloadlib\u7f16\u8bd1\u8fdblua\u4e2d\uff0c\u9700\u8981\u6539makefile.\u5982\u6b64\u8d34\u7684\u697c\u4e3b\u6240\u8ff0\uff1a&nbsp;<a href=\"http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00463.html\">http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00463.html<\/a><\/p>\n<p>\u7b2c\u4e8c\u79cd\u662f\u5728csdn\u4e0a\u7684\u8d34\u5b50\uff0c\u8981\u6539lua\u7684\u6e90\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2adefine\uff0c\u5b9e\u9645\u4e0a\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u662f\u53ef\u4ee5\u5728makefile\u4e2ddefine\u4e00\u4e2a\u53d8\u91cf\u7684\u3002<\/p>\n<p>\u4e0d\u8fc7\uff01\uff01\uff01<\/p>\n<p>\u95ee\u9898\u5176\u5b9e\u66f4\u7b80\u5355\uff0c\u4e0d\u9700\u8981\u6539\u4ec0\u4e48makefile\u6587\u4ef6\uff1a<\/p>\n<p><a href=\"http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00466.html\">http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00466.html<\/a><\/p>\n<p>lua\u57285.0\u4ee5\u540e\uff0cloadlib\u5df2\u7ecf\u4e0d\u5728\u5168\u5c40\u57df\u4e2d\u4e86\uff0cloadlib\u5728package\u540d\u5b57\u7a7a\u95f4\u4e2d\u4e86\u3002<\/p>\n<p>\u8fd9\u6837\u5c31\u597d\u4e86\uff1a<\/p>\n<p>package.loadlib(&quot;libhello.so&quot;, &quot;*&quot;)<\/p>\n<p>\u5b9e\u9645\u4e0a\uff0cloadlib\u662f\u4e00\u4e2a\u5e95\u5c42\u7684\u51fd\u6570\u3002\u4e0d\u50cfrequire,loadlib\u4e0d\u5728path\u91cc\u8fdb\u884c\u67e5\u627e\uff0c\u4e5f\u4e0d\u81ea\u52a8\u6dfb\u52a0\u6587\u4ef6\u540d\u540e\u7f00\u3002\u8fd9\u4e2a\u51fd\u6570\u5728\u67d0\u4e9b\u5e73\u53f0\u4e0a\u4e0d\u88ab\u652f\u6301\uff0c\u56e0\u4e3aANSI\u5e76\u6ca1\u6709\u8981\u6c42\u652f\u6301\u52a8\u6001\u94fe\u63a5\u5e93\u3002<\/p>\n<p>copyright ykyi.net<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2009\u5e74\u7684\u65f6\u5019\u7528\u8fc7lua\uff0c\u5f53\u65f6\u5728windows\u4e0a\u5199\u91d1\u5c71\u6025\u6551\u7bb1\u7684\u6076\u610f\u8f6f\u4ef6\u5e93\u5f15\u64ce\u3002 \u65f6\u9694\u591a\u5e74\uff0c\u53c8\u8981\u73a9\u4e00\u628alua. \u91cd\u62felua\uff0c\u5728lua\u63a7\u5236\u53f0\u7528loadlib\u8f7d\u5165\u52a8\u6001\u94fe\u63a5\u5e93\u65f6\u51fa\u9519\uff1a &gt; loadlib(&quot;libhello.so&quot;, &quot;*&quot;) stdin:1: attempt to call global &#39;loadlib&#39; (a nil value) stack traceback: stdin:1: in main chunk [C]: in ? Lua\u8868\u793a\u5728\u5168\u5c40\u57df\u4e2d\u6ca1\u6709loadlib\u3002google\u540e\u53d1\u73b0\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\uff1a \u7b2c\u4e00\u79cd\u8ba4\u4e3a\u8fd9\u79cd\u9519\u8bef\u662f\u56e0\u4e3a\u6ca1\u6709\u628aloadlib\u7f16\u8bd1\u8fdblua\u4e2d\uff0c\u9700\u8981\u6539makefile.\u5982\u6b64\u8d34\u7684\u697c\u4e3b\u6240\u8ff0\uff1a&nbsp;http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00463.html \u7b2c\u4e8c\u79cd\u662f\u5728csdn\u4e0a\u7684\u8d34\u5b50\uff0c\u8981\u6539lua\u7684\u6e90\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2adefine\uff0c\u5b9e\u9645\u4e0a\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u662f\u53ef\u4ee5\u5728makefile\u4e2ddefine\u4e00\u4e2a\u53d8\u91cf\u7684\u3002 \u4e0d\u8fc7\uff01\uff01\uff01 \u95ee\u9898\u5176\u5b9e\u66f4\u7b80\u5355\uff0c\u4e0d\u9700\u8981\u6539\u4ec0\u4e48makefile\u6587\u4ef6\uff1a http:\/\/lua-users.org\/lists\/lua-l\/2009-02\/msg00466.html lua\u57285.0\u4ee5\u540e\uff0cloadlib\u5df2\u7ecf\u4e0d\u5728\u5168\u5c40\u57df\u4e2d\u4e86\uff0cloadlib\u5728package\u540d\u5b57\u7a7a\u95f4\u4e2d\u4e86\u3002 \u8fd9\u6837\u5c31\u597d\u4e86\uff1a package.loadlib(&quot;libhello.so&quot;, &quot;*&quot;) \u5b9e\u9645\u4e0a\uff0cloadlib\u662f\u4e00\u4e2a\u5e95\u5c42\u7684\u51fd\u6570\u3002\u4e0d\u50cfrequire,loadlib\u4e0d\u5728path\u91cc\u8fdb\u884c\u67e5\u627e\uff0c\u4e5f\u4e0d\u81ea\u52a8\u6dfb\u52a0\u6587\u4ef6\u540d\u540e\u7f00\u3002\u8fd9\u4e2a\u51fd\u6570\u5728\u67d0\u4e9b\u5e73\u53f0\u4e0a\u4e0d\u88ab\u652f\u6301\uff0c\u56e0\u4e3aANSI\u5e76\u6ca1\u6709\u8981\u6c42\u652f\u6301\u52a8\u6001\u94fe\u63a5\u5e93\u3002 copyright ykyi.net<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[53],"class_list":["post-1177","post","type-post","status-publish","format-standard","hentry","category-tech_articles","tag-lua"],"_links":{"self":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1177"}],"version-history":[{"count":0,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1177\/revisions"}],"wp:attachment":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}