tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Re: TCC:cannot find -l"xyz.dll"


From: lostgallifreyan
Subject: Re: [Tinycc-devel] Re: TCC:cannot find -l"xyz.dll"
Date: Fri, 3 Apr 2009 00:57:41 +0100

grischka <address@hidden> wrote:
(03/04/2009 00:31)

>lostgallifreyan wrote:
>
> > (Some explicit DLL-making and linking command examples in TCC's
> > "tcc-doc.html" 'Quick Start' section would be nice).
>
>Well, it's in docs/readme.txt.
>

That only works if the .def file exists, my problem was I couldn't make it 
without the -rdynamic switch, and that detail isn't there, and where mentioned 
in tcc-doc.html it's far from clear to a newcomer that it will work. Only the 
word 'dynamic' tipped me off to its likely effect.

>> It seems that while TCC built a DLL from the main Lua library without a 
>> murmur of complaint without the -rdynamic switch, it still needs that 
>> switch. 
>
>That is because you missed the "-D LUA_BUILD_AS_DLL" option which
>is needed for building lua.dll and has the effect that the ymbols
>declared as "LUA_API" are exported which is how it should be.
>
>The "-rdynamic" option simply tells TCC to export just all symbols,
>which then works too, of course.
>

If it's simple, and works, it's good. Anything more complex or specific can 
come later. Frequently a person is expected to compile from a supplied source 
without having knowledge of what the source does. At the outset of exploring a 
new system, a simple and general method should be easier to find than it was 
for me. Once we have that, then we can look into what else we can learn.

>See this section in luaconf.h (Note however that __declspec(dllimport)
>has no effect with TCC. It is not needed for functions, only for
>data which TCC doesn't support currently)
>
>/*
>@@ LUA_API is a mark for all core API functions.
>@@ LUALIB_API is a mark for all standard library functions.
>** CHANGE them if you need to define those functions in some special way.
>** For instance, if you want to create one Windows DLL with the core and
>** the libraries, you may want to use the following definition (define
>** LUA_BUILD_AS_DLL to get it).
>*/
>#if defined(LUA_BUILD_AS_DLL)
>
>#if defined(LUA_CORE) || defined(LUA_LIB)
>#define LUA_API __declspec(dllexport)
>#else
>#define LUA_API __declspec(dllimport)
>#endif
>
>#else
>
>#define LUA_API         extern
>
>#endif
>

Thankyou. I'll try this too, but I really think that the emphasis on using the 
-rdynamic switch as early as possible in the help docs is vital. It allowed me 
to compile the DLL (and subsequetly the linked EXE) without needing any 
modification of the source. That point makes this important, I think. It gives 
a good starting point. It's hard to wade through detail without having first 
seen something work, if there IS a simpler way to make it work, and in this 
case there is. It just wasn't easy or obvious to me except with hindsight, 
which is no good before the fact.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]