Dne 11.8.2012 12:26, Ruben Van Boxem napsal(a):
> Would you mind conjuring up a small test case (dll .c file, main.c 
> file and compile options)? dllexport/dllimport of normal functions 
> should work (dllexport of C++ classes is WIP). I *seem* to remember 
> using a Clang-built GSL DLL once before, but I may be mistaken.

The goal (corresponding to the uriginal case) is to output a DLL where 
__stdcall
symbols are exported without the decoration as Windows system DLLs do.

Not sure, if the mailing list here is friendly to attachments, so you 
can find it in-lined
(probably with broken tab chars for the Makefile) below and I have also 
uploaded it
to http://www.sendspace.com/file/2xmasj

There is a source and a makefile with phony targets "gcc" and "clang". 
When building
with the combined package 
i686-w64-mingw32-clang-3.1-release-win32_rubenvb.7z
and i686-w64-mingw32-gcc-dw2-4.6.3-1-release-win32_rubenvb.7z, I get 
this output:

$ make gcc
gcc -c  -Wall dll.c -o gcc.o
gcc -mwindows -mdll -Wl,--kill-at gcc.o -o gcc.dll -Wl,--output-def,gcc.def

$ make clang
clang -c  -Wall dll.c -o clang.o
gcc -mwindows -mdll -Wl,--kill-at clang.o -o clang.dll 
-Wl,--output-def,clang.def
Cannot export _ExportedFunction@0: symbol not found
collect2: ld returned 1 exit status
make: *** [clang] Error 1

The example builds the DLL using the __declspec(export) way. My original 
report has
said the issue also happens when using .def file, but it's not true as I 
overlooked
the .def file has been generated by script itself as this example does 
and the .def file
from clang-built objects leads to .def file with leading underscores 
which is probably
the culprit here.

(I.e. using manually created .def file works. Still this is a bug.)

Morous



==== dll.c ====

#include <windows.h>

int __declspec(dllexport) __stdcall
ExportedFunction(void)
{
     return 42;
}


==== Makefile ====

CFLAGS = -Wall
LDFLAGS = -mwindows -mdll -Wl,--kill-at


.PHONY: all gcc clang clean

all: gcc clang

gcc:
     gcc -c $(CPPFLAGS) $(CFLAGS) dll.c -o gcc.o
     gcc $(LDFLAGS) gcc.o -o gcc.dll -Wl,--output-def,gcc.def

clang:
     clang -c $(CPPFLAGS) $(CFLAGS) dll.c -o clang.o
     gcc $(LDFLAGS) clang.o -o clang.dll -Wl,--output-def,clang.def

clean:
     rm -f gcc.o gcc.def gcc.dll
     rm -f clang.o clang.def clang.dll


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to