|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D.gnu - Interesting error
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? Dec 22 2005
Regan Heath wrote: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? Dec 22 2005
On Thu, 22 Dec 2005 15:59:20 -0500, clayasaurus <clayasaurus gmail.com> wrote:Regan Heath wrote: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? 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. 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. Dec 25 2005
|