New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building dll on windows does not export symbols #1443

Closed
Hejsil opened this Issue Aug 31, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@Hejsil
Member

Hejsil commented Aug 31, 2018

Code:

export fn a(data: *c_void, size: i32) i32 {
    return 0;
}

Command:

zig build-lib .\a.zig --output a.dll

Running dumpbin.exe /EXPORTS a.dll

Dump of file a.dll

File Type: DLL

  Summary

        1000 .bss
        1000 .data
        1000 .idata
        1000 .pdata
        1000 .rdata
        1000 .reloc
        D000 .text
        1000 .xdata

Expected output should be something like this:

Dump of file test.dll

File Type: DLL

  Section contains the following exports for test.dll

    00000000 characteristics
    5B8916D5 time date stamp Fri Aug 31 12:22:13 2018
        0.00 version
           1 ordinal base
           1 number of functions
           1 number of names

    ordinal hint RVA      name

          1    0 00001000 a

  Summary

        2000 .data
        1000 .gfids
        1000 .pdata
        9000 .rdata
        1000 .reloc
        A000 .text

@andrewrk andrewrk added this to the 0.3.0 milestone Sep 2, 2018

@emekoi

This comment has been minimized.

Contributor

emekoi commented Sep 26, 2018

could this be because of how zig doesn't compile unused functions?

@andrewrk

This comment has been minimized.

Member

andrewrk commented Sep 26, 2018

No because the function is exported.

@andrewrk andrewrk closed this in af3263d Sep 27, 2018

@andrewrk

This comment has been minimized.

Member

andrewrk commented Sep 27, 2018

export fn hello(data: *c_void, size: i32) i32 {
    return 0;
}
>dumpbin /EXPORTS hello.dll
Microsoft (R) COFF/PE Dumper Version 14.15.26729.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file hello.dll

File Type: DLL

  Section contains the following exports for hello.dll

    00000000 characteristics
           0 time date stamp
        0.00 version
           0 ordinal base
           3 number of functions
           2 number of names

    ordinal hint RVA      name

          1    0 0001D850 _DllMainCRTStartup = _DllMainCRTStartup
          2    1 00001620 hello = hello

  Summary

        1000 .data
        2000 .pdata
       70000 .rdata
        1000 .reloc
       25000 .text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment