Option --output-def of LD generates a non syntax valid definition file.
Windows XP SP2
Steps to reproduce the bug:
We want to generate a dll with functions in function.c, and export its definition file.
1. Compile function.c. This function uses WlanReasonCodeToString in wlanapi.dll.
gcc -c -Wall function.c -o function.o
2. Generate the dll and its definition file (if you don't have
wlanapi.dll, you can use one of the wlanapi folder)
ld -L./ -shared -o library.dll --output-def bad_syntax.def function.o -lwlanapi
The generated DEF file may be used as a reference to automatically or
implicitly exported symbols.
In step 3 we are going to use the DEF file in this mentioned way. So
we could check its syntax.
3. Create the dll using DEF file to indicate what symbols will be exported.
ld -L./ -shared -o library.dll bad_syntax.def function.o -lwlanapi
Ld gives the following error in step 3:
ld: bad_syntax.def:2: syntax error
ld:bad_syntax.def: file format not recognized; treating as linker script
ld:bad_syntax.def:2: syntax error
As we can see, --output-def of LD has generated a non syntax valid definition file.
Log in to post a comment.