[LLVMdev] LLVM 3.0 - Windows - auto-importing issue with llvm::CallInst
alan.garny at dpag.ox.ac.uk
Sun Dec 4 05:27:05 PST 2011
Yes, I am aware of all of this (i.e. the way shared libraries work on
Windows and of the auto-importing feature in MinGW gcc). However, I can't
explain to myself why I got that message for llvm::CallInst and no other
LLVM function.?! Also, I would rather MinGW gcc work the way it ought to on
Windows, rather than find a way around the problem, no matter how convenient
it may be.
From: Kevin Kelley [mailto:kevin at kelleysoft.com]
Sent: 03 December 2011 13:52
To: Alan Garny
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] LLVM 3.0 - Windows - auto-importing issue with
On 12/2/2011 9:09 AM, Alan Garny wrote:
However, there is one new (minor) issue which is that when building my
application I get a warning from the linker about auto-importing having been
activated without -enable-auto-import being specified on the command line.
Indeed, for some reason, the vtable for llvm::CallInst has to be resolved.?!
This is clearly not critical since I can get rid of the warning by adding
-enable-auto-import on the command line, but I wish I didn't have to do that
(it's not clean in my view).
Mostly harmless... for shared libs on Windows you'd normally have to either:
use __declspec(dllexport) on exported functions, and __declspec(dllimport)
on the prototypes for code that uses them; or:
list symbols to be exported in a .def file when building the dll, and
link with that .def file when building code that uses it.
GCC on mingw came up with the "auto-import" option to avoid those
nuisances by, automatically exporting everything, if otherwise there'd
be no exports and you're building a shared-lib. When it does this
without being told to, it emits that warning message, so you know
I think that that warning went away in later versions -- this seems
to be the most-appropriate behavior and apparently doesn't
cause problems, so for GCC, auto-import and no special markings
on your code is what you should usually do.
But I'm not an expert -- just trying to follow along. There are
potential issues with relocations and thunks and position-independent
code and intermittent failures when DLL relocations "collide"...
but I really don't want to have to worry about that.
(a couple interesting links ab't enable-auto-import):
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev