Linker can't resolve any references

Bob Cowdery bob@bobcowdery.plus.com
Wed Jun 23 13:05:00 GMT 2010


Kai Ruottu wrote:
> 23.6.2010 10:51, Kai Ruottu kirjoitti:
>
>>>> Bob Cowdery<bob@bobcowdery.plus.com> writes:
>>>>
>>>>> This is such a basic problem I must be doing something daft. I have a
>>>>> set of static libraries which I am linking into a dll. None of the
>>>>> external references seem to be getting resolved. This is on Win7
>>>>> and I
>>>>> have MinGW and msys installed using the msys make.
>>
>> I would check the instructions for creating DLLs...
>
> Ok, the basic idea used to be that when linking the DLL also it's
> equivalent "import library", 'libmydll.a' for the 'libmydll.dll'
> would be created. Whether the '-shared' does this automatically is
> unclear. For instance at :
>
> http://sig9.com/node/35
>
> there is the phase "3" :
>
> # Creating the dll
>
> gcc -shared -o message.dll dll.o -Wl,--out-implib,libmessage.a
>
> for creating the import library at the same time with the DLL
> itself.
>
> When linking executables which will use the DLL, the import lib
> will be used, NOT the DLL itself!
>
Kai
All good ideas but unfortunately the test I did used a standard 'Hello
World' exe into which I dragged in two static libraries. With no
references from my main code to the libraries it built and the size was
20k. If I then made a call to one of the libraries (call this libA)
where there were no other dependencies it again built and the size was
21k. If I then commented out the call to libA and made a call to the
second library (call this libB) the size was 30k but I got undefined
references for all the calls from libB to libA (from the size libA is
now not being linked in). If I kept in both the calls the size was 31k
and it built ok. Weird or what!

Bob
>
>



More information about the Gcc-help mailing list