What format is the .lib file in the SDK?

May 30, 2008
122
1
#1
Normally, I use gcc (mingw) as my C compiler, so I am not surprised
that the TakeCmd.lib file supplied with the SDK isn't of any use to
me. But I just now tried MS C (specifically, MS Visual C++ 2008
Express edition from the command line, only to find that it doesn't
seem to work with that, either!!!


>cl /LD /O2 Lua.c /I sdk /I \Utils\Lua\include sdk\TakeCmd.lib \Utils\Lua\lib\lua51.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

Lua.c
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

/out:Lua.dll
/dll
/implib:Lua.lib
Lua.obj
sdk\TakeCmd.lib
\Utils\Lua\lib\lua51.lib
Creating library Lua.lib and object Lua.exp
Lua.obj : error LNK2019: unresolved external symbol
[email protected] referenced in function _StdinIsUnicode
Lua.obj : error LNK2019: unresolved external symbol
[email protected] referenced in function _StdinIsUnicode
Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function _StdinIsUnicode
Lua.obj : error LNK2019: unresolved external symbol _encode referenced
in function _luaU_reader
Lua.obj : error LNK2019: unresolved external symbol _ReadStdInput
referenced in function _luaU_reader
Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function _luaU_reader
Lua.obj : error LNK2019: unresolved external symbol _Qprintf
referenced in function _luaU_printerr
Lua.obj : error LNK2019: unresolved external symbol _decode referenced
in function _luaU_printerr
Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function [email protected]
Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function _tcc_exec
Lua.obj : error LNK2019: unresolved external symbol
[email protected] referenced in function _create_args

Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function _create_args
Lua.obj : error LNK2019: unresolved external symbol [email protected]
referenced in function _create_args
Lua.obj : error LNK2019: unresolved external symbol _Printf referenced
in function [email protected]
Lua.dll : fatal error LNK1120: 14 unresolved externals

So what precisely is TakeCmd.lib meant to be used for? And how should
I use the SDK without needing to manually hack an import library for
TakeCmd.dll?

Paul.
 

samintz

Scott Mintz
May 20, 2008
1,272
11
Solon, OH, USA
#2
The functions in TakeCmd.lib are decorated names. As a simple test, try
renaming Lua.c to Lua.cpp and recompiling and see what happens.

-Scott

"p.f.moore" <> wrote on 07/10/2008 04:33:43 PM:


> Normally, I use gcc (mingw) as my C compiler, so I am not surprised
> that the TakeCmd.lib file supplied with the SDK isn't of any use to
> me. But I just now tried MS C (specifically, MS Visual C++ 2008
> Express edition from the command line, only to find that it doesn't
> seem to work with that, either!!!
>

> Quote:
>
> >cl /LD /O2 Lua.c /I sdk /I \Utils\Lua\include sdk\TakeCmd.lib
> \Utils\Lua\lib\lua51.lib
>
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.
> 08 for 80x86
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> Lua.c
> Microsoft (R) Incremental Linker Version 9.00.21022.08
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> /out:Lua.dll
> /dll
> /implib:Lua.lib
> Lua.obj
> sdk\TakeCmd.lib
> \Utils\Lua\lib\lua51.lib
> Creating library Lua.lib and object Lua.exp
> Lua.obj : error LNK2019: unresolved external symbol
> [email protected] referenced in function _StdinIsUnicode
> Lua.obj : error LNK2019: unresolved external symbol
> [email protected] referenced in function _StdinIsUnicode
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function _StdinIsUnicode
> Lua.obj : error LNK2019: unresolved external symbol _encode referenced
> in function _luaU_reader
> Lua.obj : error LNK2019: unresolved external symbol _ReadStdInput
> referenced in function _luaU_reader
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function _luaU_reader
> Lua.obj : error LNK2019: unresolved external symbol _Qprintf
> referenced in function _luaU_printerr
> Lua.obj : error LNK2019: unresolved external symbol _decode referenced
> in function _luaU_printerr
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function [email protected]
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function _tcc_exec
> Lua.obj : error LNK2019: unresolved external symbol
> [email protected] referenced in function _create_args
>
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function _create_args
> Lua.obj : error LNK2019: unresolved external symbol [email protected]
> referenced in function _create_args
> Lua.obj : error LNK2019: unresolved external symbol _Printf referenced
> in function [email protected]
> Lua.dll : fatal error LNK1120: 14 unresolved externals
>
> So what precisely is TakeCmd.lib meant to be used for? And how should
> I use the SDK without needing to manually hack an import library for
> TakeCmd.dll?
>
> Paul.
>
 
May 30, 2008
122
1
#3
2008/7/10 samintz <>:

> The functions in TakeCmd.lib are decorated names. As a simple test, try
> renaming Lua.c to Lua.cpp and recompiling and see what happens.
That worked, thanks. I thought I'd done the equivalent by specifying
/Tp, but I must have got it wrong :-(

It would still be nice to have a plain C version, for portability, but
my ugly hacks do that.

Paul.
 

rconn

Administrator
Staff member
May 14, 2008
10,506
94
#4
p.f.moore wrote:

> 2008/7/10 samintz <>:
>
> Quote:
> > The functions in TakeCmd.lib are decorated names. As a simple test, try
> > renaming Lua.c to Lua.cpp and recompiling and see what happens.
>
> That worked, thanks. I thought I'd done the equivalent by specifying
> /Tp, but I must have got it wrong :-(
>
> It would still be nice to have a plain C version, for portability, but
> my ugly hacks do that.
The disadvantage of a plain C version is that the rest of TCMD and TCC
then wouldn't be able to use TakeCmd.dll (which is, after all, its
reason for being!).

Rex Conn
JP Software
 
May 30, 2008
122
1
#5
2008/7/11 rconn <>:

> p.f.moore wrote:
> The disadvantage of a plain C version is that the rest of TCMD and TCC
> then wouldn't be able to use TakeCmd.dll (which is, after all, its
> reason for being!).
I was thinking of a plain C import library *as well* as the C++
version. After all, DLLs are supposed to be callable cross-language...

It's not a huge issue, as I have hacks that work for me (the @4 style
decorations take some fiddling to get rid of, the rest isn't much
problem).

Paul.