lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On VS 2008 everything works fine.

On VS 2010 i tried a lot of things and the same thing happened.
I use LUA source code, so all the times i compile and link the entire project.
I tried to link with LUA as DLL, as static, and finally i created a new LUA project and a new simple application to access LUA, but all the times the same link errors have been displayed. 

My project is composed of some DLLs, and all of them linked fine too. The link errors occur only with all LUA functions.

1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_openlibs referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init@DsCScriptEngine@@QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_newstate referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init@DsCScriptEngine@@QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_close referenced in function "public: void __thiscall DsCScriptEngine::Shutdown(void)" (?Shutdown@DsCScriptEngine@@QAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pcall referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute@DsCScriptEngine@@QAEJPBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_loadfile referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute@DsCScriptEngine@@QAEJPBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_error referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushstring referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_ref referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_getfield referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_settop referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)

and so...

-- 
---------------------------------------------
Jorg B Jorge (@realjbj)
jbj@ip.tv
http://www.ip.tv
http://jbjorge.blogspot.com
http://br.linkedin.com/in/jbjorge
---------------------------------------------


On Sat, Oct 2, 2010 at 11:00 AM, Del Buono, Matthew Paul <delbu9c1@my.erau.edu> wrote:
Have you actually checked your settings?

There's a lot more than a lua problem here. You're missing a ton of symbols -- as if you're not linking an libraries.

As for the calling convention. It is correct with an underscore and has not changed.

Matt

Sent from my Verizon Wireless BlackBerry


From: Stefan Sandberg <keffo.sandberg@gmail.com>
Sender: <lua-l-bounces@lists.lua.org>
Date: Sat, 2 Oct 2010 12:50:27 +0200
To: <lua-l@lists.lua.org>
ReplyTo: Lua mailing list <lua-l@lists.lua.org>
Subject: Re: Linking LUA with VS 2010

You're trying to link the lua dll import library which was not built with vs 2010?
Where does that library come from, who built it and how?

I'm pretty certain vs 2010 is compatible with itself, so assuming someone else built that library using some other compiler etc,
you need to make sure you/they agree on stuff like calling convention, CRT and so forth.




On 2010-10-01 23:37, Jorg B. Jorge wrote:
We use LUA script to let users to customize our server software written in C++.

At the moment we are porting the 32 bits Windows version of our project to Visual Studio 2010.
Once everything works fine with VS 2008, we thought that we would have no problem on upgrade process.

Unfortunately whenever we tried to link the lualib (as dll) to our project in VS 2010, the lua functions could not be found anymore by the linker (the error messages are displayed below). 

It seems that some calling convention is wrong on 2010, like the application may be looking for the lua functions with a prefix '_'.

To access lua functions (written in C) from our project modules (C++) we use this:

extern "C" {
#include "lua/src/lua.h"
#include "lua/src/lualib.h"
#include "lua/src/lauxlib.h"
}

The same project compiles and links with lualib successfully on VS 2008 and Linux (g++).


Could anybody help me with this ?


1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_openlibs referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init@DsCScriptEngine@@QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_newstate referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init@DsCScriptEngine@@QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_close referenced in function "public: void __thiscall DsCScriptEngine::Shutdown(void)" (?Shutdown@DsCScriptEngine@@QAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pcall referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute@DsCScriptEngine@@QAEJPBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_loadfile referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute@DsCScriptEngine@@QAEJPBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_error referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushstring referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_ref referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_getfield referenced in function "public: class DsCScriptValue __thiscall DsCScriptEngine::GetGlobalValue(char const *)" (?GetGlobalValue@DsCScriptEngine@@QAE?AVDsCScriptValue@@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_settop referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushvalue referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_call referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_rawgeti referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_type referenced in function "public: long __cdecl DsCScriptEngine::CallGlobalFunction(char const *,int,int,...)" (?CallGlobalFunction@DsCScriptEngine@@QAAJPBDHHZZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_createtable referenced in function "public: __thiscall DsCScriptTableValue::DsCScriptTableValue(class DsCScriptEngine const &)" (??0DsCScriptTableValue@@QAE@ABVDsCScriptEngine@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_rawseti referenced in function "public: void __thiscall DsCScriptTableValue::AddValue(class DsCScriptValue &)" (?AddValue@DsCScriptTableValue@@QAEXAAVDsCScriptValue@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_objlen referenced in function "public: void __thiscall DsCScriptTableValue::AddValue(class DsCScriptValue &)" (?AddValue@DsCScriptTableValue@@QAEXAAVDsCScriptValue@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_settable referenced in function "public: void __thiscall DsCScriptTableValue::SetValue(class DsCScriptValue &,class DsCScriptValue &)" (?SetValue@DsCScriptTableValue@@QAEXAAVDsCScriptValue@@0@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushnumber referenced in function "public: __thiscall DsCScriptValue::DsCScriptValue(class DsCScriptEngine const &,double)" (??0DsCScriptValue@@QAE@ABVDsCScriptEngine@@N@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_unref referenced in function "public: __thiscall DsCScriptValue::~DsCScriptValue(void)" (??1DsCScriptValue@@QAE@XZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_tolstring referenced in function "public: char const * __thiscall DsCScriptValue::GetStr(void)const " (?GetStr@DsCScriptValue@@QBEPBDXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_isstring referenced in function "public: char const * __thiscall DsCScriptValue::GetStr(void)const " (?GetStr@DsCScriptValue@@QBEPBDXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_tonumber referenced in function "public: double __thiscall DsCScriptValue::GetInt(void)const " (?GetInt@DsCScriptValue@@QBENXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_isnumber referenced in function "public: double __thiscall DsCScriptValue::GetInt(void)const " (?GetInt@DsCScriptValue@@QBENXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_tocfunction referenced in function "public: int (__cdecl*__thiscall DsCScriptValue::GetCFunc(void)const )(struct lua_State *)" (?GetCFunc@DsCScriptValue@@QBEP6AHPAUlua_State@@@ZXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_iscfunction referenced in function "public: int (__cdecl*__thiscall DsCScriptValue::GetCFunc(void)const )(struct lua_State *)" (?GetCFunc@DsCScriptValue@@QBEP6AHPAUlua_State@@@ZXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_gettable referenced in function "public: class DsCScriptValue __thiscall DsCScriptValue::GetTableValue(char const *)" (?GetTableValue@DsCScriptValue@@QAE?AV1@PBD@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_setfield referenced in function "public: long __thiscall DsCScriptEngine::RegisterCFunction(class IDsScriptFunction *)" (?RegisterCFunction@DsCScriptEngine@@QAEJPAVIDsScriptFunction@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushcclosure referenced in function "public: long __thiscall DsCScriptEngine::RegisterCFunction(class IDsScriptFunction *)" (?RegisterCFunction@DsCScriptEngine@@QAEJPAVIDsScriptFunction@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushlightuserdata referenced in function "public: long __thiscall DsCScriptEngine::RegisterCFunction(class IDsScriptFunction *)" (?RegisterCFunction@DsCScriptEngine@@QAEJPAVIDsScriptFunction@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pushnil referenced in function "protected: void __thiscall IDsScriptFunction::AddReturnValue(void)" (?AddReturnValue@IDsScriptFunction@@IAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_toboolean referenced in function "int __cdecl luaCFunc(struct lua_State *)" (?luaCFunc@@YAHPAUlua_State@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_gettop referenced in function "int __cdecl luaCFunc(struct lua_State *)" (?luaCFunc@@YAHPAUlua_State@@@Z)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_touserdata referenced in function "int __cdecl luaCFunc(struct lua_State *)" (?luaCFunc@@YAHPAUlua_State@@@Z)



Thanks,


--
---------------------------------------------
Jorg B Jorge (@realjbj)
jbj@ip.tv
http://www.ip.tv
http://jbjorge.blogspot.com
http://br.linkedin.com/in/jbjorge
---------------------------------------------