Re: Windows DLLs from Unix with minimum effort

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

 



Jason Curl wrote:

>  ./configure CC="gcc -mno-cygwin" LDFLAGS="-Wl,--kill-at" --target=i586-pc-mingw32 --disable-static
> on Cygwin to generate the Windows DLL

Target is not the right thing to use here.  Target only has meaning in
the context of building tools that themselves generate code, such as
compilers, linkers, assemblers, etc.  If you want to simply indicate
that you are cross-compiling a library for a host different than the
current one then you use --host.  Also, if you're going to use Cygwin as
a "Fake mingw" then you probably also should use --build=mingw as well.

> I have also another subdirectory that tests the library but I can't link to it using mingw. First it doesn't recognise that the name was simplified (it looks for _my_func@24 for example instead of _my_func/my_func).

You need to understand that the --kill-at is a linker option.  It cannot
change behavior of the compiler, and when gcc is told to use the stdcall
calling convention for a function, it includes the normal stdcall
decorations on the symbol.  There is no way to change this AFAIK, unless
you use __attribute__((alias)) or something.

So if you want to use these symbols without the stdcall decoration, then
you have to get the linker to jump throuh hoops.  --kill-at removes them
from names that are exported, but that still doesn't change the fact
that the compiler emits calls to the decorated names.  For that you will
have to use --enable-stdcall-fixup, which will link calls to _foo@4 to
_foo if there is no _foo@4 found anywhere.  Or, you could create an
import library and link with that.

But instead of all of that I think I would just simply use
--add-stdcall-alias.  This should result in both a decorated and
undecorated alias of each symbol being exported, so you don't have to
try to pretend that gcc isn't emitting calls to decorated names when it
really is.

Brian


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux