[LLVMdev] A first!

Reid Spencer reid at x10sys.com
Thu Dec 23 20:05:48 PST 2004

On Thu, 2004-12-23 at 19:44, Jeff Cohen wrote:
> The interpreter still resolves printf using a hack.  It does try to use 
> DynamicLibrary to find it, but fails.  DynamicLibrary on Windows only 
> searches the main program executable for symbols, lli.exe in this case.  
> As the C/C++ runtime is in a DLL, it won't find printf in lli.exe.  It 
> ought to then search the runtime DLL, the name of which depends on how 
> the binaries are built, but it doesn't.  It should probably enumerate 
> and search all DLLs present in the process, including the system DLLs so 
> that a program can use the Win32 API, but there's no code to do that in 
> ltdl.c.

Okay, this is *supposed* to be happening automatically. The same issue
will happen on unix with shared objects loaded dynamically. So, either
DynamicLibrary.cpp is using ltdl wrong or there's a win-specific bug in
ltdl.cpp (doubt it, this code's been around for a while).

> This code needs to be added, but I'm not sure where.  
> win32/DynamicLibrary.cpp is not the place, as it is never compiled, just 
> as none of */DynamicLibrary.cpp are compiled. 

Yeah, that was the original implementation. I just deleted them all.
Sorry for the confusion, I haven't gotten to cleanning up lib/System
yet. That will probably happen next week.

> I still don't know why these files exist.  

They shouldn't :)

> But ltdl.c doesn't feel right either, as it's GNU 
> software.  The main DynamicLibrary.cpp is supposed to be platform 
> independent, so that doesn't seem appropriate either, nonetheless seems 
> to be the best bet.

DynamicLibrary.cpp is "supposed" to be platform agnostic, but we make an
exception in its special case. It already has Darwin specific hacks in
it for certain symbols. We need to figure out why the DDLs aren't
getting searched and (hopefully) fix our use of ltdl in DynamicLibrary
so that they are searched. If you want to take a crack at it, feel free,
I have some other issues to work on. If you'd rather me do it, let me
know so I don't wait for you :)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041223/7f132793/attachment.sig>

More information about the llvm-dev mailing list