in reply to On Yaks and the Shaving Thereof - finding exported symbols of a C library

if you're fine with command line, then
dumpbin /exports perl513.dll
could provide you with needed information with a quite simple text output that should be enough for you
.... 37 24 002126B4 PL_collation_ix 38 25 00213AC8 PL_collation_name 39 26 002100E4 PL_collation_standard 40 27 00213A64 PL_collxfrm_base 41 28 002100E0 PL_collxfrm_mult 42 29 00213440 PL_colors 43 2A 00213544 PL_colorset ....

I've browsed C API and haven't found a function that lists functions from a DLL
I seem to remember that one could get a function by ordinal number (@3) but these must be false memories implanted by someone.

Win32::API is closest that I could advice, and this also suggests you know name of your function.

Replies are listed 'Best First'.
Re^2: On Yaks and the Shaving Thereof - finding exported symbols of a C library
by BrowserUk (Patriarch) on Mar 23, 2011 at 09:53 UTC

    You can. See GetProcAddress(), and the references to "ordinal". But that only allows you to access the addresses of the exported routines, not their names.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Aha...

      As long as GetProcAddress is in the core, you even can use it from Perl...
      but - beware: perldoc win32

      Win32::GetProcAddress(INSTANCE, PROCNAME) Returns the address of a function inside a loaded library. The information about what you can do with this address has been l +ost in the mist of time. Use the Win32::API module instead of this deprecated function.

      anyway, you could do this in XS, then, but still - I would prefer parsing output of 'dumpbin' command...

      update still no way to have function name by ordinal, BTW...
      :(

        Yes - my current list of preferences is

        1. See how ExtUtils::CChecker fares, especially concerning speed per checked symbol and the compatibility wishes of Maddingue. Currently Net::Pcap claims to be compatible back to Perl 5.004, and this build prerequisite will likely break that.
        2. See whether I can coax DynaLoader into providing a list of symbols. On Win32, DynaLoader is basically LoadLibrary() and GetProcAddress() anyway.
        3. Parse the output of nm or dumpbin.exe to get at the list of exported symbols. This has the attractive feature of allowing to find the symbols not only of DLLs but also of .a and .o files.