Tencent / xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Other
9.43k stars 2.46k forks source link

xlua集成第三方库转webgl报错 #1089

Closed cwclive2 closed 2 months ago

cwclive2 commented 1 year ago

操作 1、集成第三方库rapidjson `[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] public static extern int luaopen_rapidjson(System.IntPtr L);

    [MonoPInvokeCallback(typeof(LuaDLL.lua_CSFunction))]
    public static int LoadRapidJson(System.IntPtr L)
    {
        return luaopen_rapidjson(L);
    }`

AddBuildin("rapidjson", XLua.LuaDLL.Lua.LoadRapidJson); 2、编译android版本的xlua 3、unity选择webgl平台编辑 出现如下错误 Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js: undefined symbol: luaopen_rapidjson (referenced by top-level compiled C/C++ code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

UnityLearnerr commented 1 year ago

解决了吗?遇到了同样的问题

Philofallever commented 1 year ago

WebGL应该需要c源码,跟xlua没关系 看看文档吧

wyjxp commented 7 months ago

同问,没看到文档里有说这个问题

chexiongsheng commented 2 months ago

你这个c#文件(不是官方的)表示你要用rapidjson,需要把它的源码加到webgl的编译,参考这里,这里加好了:https://github.com/chexiongsheng/build_xlua_with_libs/tree/master/LibsTestProj

如果你项目实际不需要用rapidjson,可以把这个C#文件删掉