D.gnu - Interesting error
- daerid (21/21) Dec 22 2005 I'm trying to work with the lua D port at
- Regan Heath (5/24) Dec 22 2005 Can you post the definition of "lauL_reg" and "luaopen_base". I've seen ...
- clayasaurus (10/44) Dec 22 2005 extern (C) {
- Regan Heath (5/47) Dec 22 2005 And what about "lua_CFunction" :)
- clayasaurus (8/36) Dec 22 2005 The problem seemed to be that lua_CFunction was defined as
I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here? Bryan Ross daerid gmail.com
Dec 22 2005
On Thu, 22 Dec 2005 10:11:03 +0000 (UTC), daerid <daerid gmail.com> wrote:I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here?Can you post the definition of "lauL_reg" and "luaopen_base". I've seen an error like this when the "extern" type was different, perhaps that is the case here? Regan
Dec 22 2005
Regan Heath wrote:On Thu, 22 Dec 2005 10:11:03 +0000 (UTC), daerid <daerid gmail.com> wrote:extern (C) { struct luaL_reg { const char *name; lua_CFunction func; }; int luaopen_base (lua_State *L); } Both are extern(C). I'll play around and see if I can re-create that error in a little bit.I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here?Can you post the definition of "lauL_reg" and "luaopen_base". I've seen an error like this when the "extern" type was different, perhaps that is the case here? Regan
Dec 22 2005
On Thu, 22 Dec 2005 15:59:20 -0500, clayasaurus <clayasaurus gmail.com> wrote:Regan Heath wrote:And what about "lua_CFunction" :)On Thu, 22 Dec 2005 10:11:03 +0000 (UTC), daerid <daerid gmail.com> wrote:extern (C) { struct luaL_reg { const char *name; lua_CFunction func; }; int luaopen_base (lua_State *L); } Both are extern(C).I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here?Can you post the definition of "lauL_reg" and "luaopen_base". I've seen an error like this when the "extern" type was different, perhaps that is the case here? ReganI'll play around and see if I can re-create that error in a little bit.Ok. Regan
Dec 22 2005
The problem seemed to be that lua_CFunction was defined as alias int (*lua_CFunction) (lua_State *L); The fix is to use stronger typing like typedef int (*lua_CFunction) (lua_State *L); I just commited new changes to the trunk which fix this problem. Update to that version and tell me if you are having any more problems. Thanks. ~ Clay daerid wrote:I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here? Bryan Ross daerid gmail.com
Dec 22 2005
I also got this fixed by a different route. All the functions in lua.d are declared like: extern int lua_gettop (lua_State *L); whereas luaopen_base is declared like so: /*LUA_API*/ int luaopen_base (lua_State * L); so I replaced all the /*LUA_API*/ entries with 'extern' and all was good in the world. In article <dof6qb$798$1 digitaldaemon.com>, clayasaurus says...The problem seemed to be that lua_CFunction was defined as alias int (*lua_CFunction) (lua_State *L); The fix is to use stronger typing like typedef int (*lua_CFunction) (lua_State *L); I just commited new changes to the trunk which fix this problem. Update to that version and tell me if you are having any more problems. Thanks. ~ Clay daerid wrote:I'm trying to work with the lua D port at http://svn.dsource.org/projects/bindings/trunk/lua/ And I ran into an interesting error: "cannot implicitly convert expression (#luaopen_base) of type int(C *)(lua_State * L) to int(C *)(lua_State* L)" When compiling this code: ----------------------------------------------- import lua.lua; import lua.lualib; import lua.lauxlib; int main(char[][] args) { lauL_reg lr; lr.name = "base"; lr.func = &luaopen_base; return 0; } ----------------------------------------------- Anybody have any idea what's going on here? Bryan Ross daerid gmail.com
Dec 24 2005
"daerid" <daerid gmail.com> wrote ...I also got this fixed by a different route. All the functions in lua.d are declared like: extern int lua_gettop (lua_State *L); whereas luaopen_base is declared like so: /*LUA_API*/ int luaopen_base (lua_State * L); so I replaced all the /*LUA_API*/ entries with 'extern' and all was good in the world.Sigh ... gotta' love that :-)
Dec 24 2005
I know. You'd think that the compiler would be smart enough to realize that a function declared (and not defined) inside an extern (C) block would be 'extern'. Also, IMO, extern is a storage-class identifier, isn't it? It shouldn't affect type resolution. Especially when it produces messages like: "Could not implicitly cast from type T to T" where both types are reportedly identical. Just a thought In article <dol316$25jd$1 digitaldaemon.com>, Kris says..."daerid" <daerid gmail.com> wrote ...I also got this fixed by a different route. All the functions in lua.d are declared like: extern int lua_gettop (lua_State *L); whereas luaopen_base is declared like so: /*LUA_API*/ int luaopen_base (lua_State * L); so I replaced all the /*LUA_API*/ entries with 'extern' and all was good in the world.Sigh ... gotta' love that :-)
Dec 25 2005