GetProcAddress works with __cdecl but not __stdcall; symbol mangling ??

Discussion in 'Windows Vista Drivers' started by Bryan, Nov 11, 2003.

  1. Bryan

    Bryan Guest

    hi,

    i'm using GetProcAddress to get the address of an exported function in a dll
    i load with LoadLibrary. when i build the dll with the function using the c
    calling conventions (cdecl), GetProcessAddress is successful. however, when
    i build the dll with the function using stdcall convention GetProcAddress
    fails.

    I feel like the problem may be with symbol mangling, but i'm not sure. any
    suggestions are appreciated.

    thanks,
    bryan
     
    Bryan, Nov 11, 2003
    #1
    1. Advertisements

  2. Bryan

    Bryan Guest

    okay, i determined what the problem was. when i prefix an underscore and
    suffix an @x to the symbol, GetProcAddress succeeds. however, this is not
    really desirable.

    thanks.
     
    Bryan, Nov 11, 2003
    #2
    1. Advertisements

  3. Bryan

    Calvin Guan Guest

    If you export functions via a .DEF file, the function name won't get
    decorated.

    In any cases, dumpbin /exports image_name.ext_name, (sample: dumpbin
    /exports c:\winnt\system32\ntoskrnl.exe) can tell what the actual exported
    names are.

    Calvin

    --
    Calvin Guan, Software Developer
    SW2D-Radeon NT Core Drivers
    ATI Technologies Inc.
    1 Commerce Valley Drive East
    Markham, Ontario, Canada L3T 7X6
    Tel: (905) 882-2600 Ext. 8654
    Find a driver: http://www.ati.com/support/driver.html
     
    Calvin Guan, Nov 11, 2003
    #3
  4. Bryan

    Bryan Guest

    thanks calvin.

    right, i really don't want to have to use a .def file.

    bryan
     
    Bryan, Nov 11, 2003
    #4
  5. This is the only way of exporting undecorared names. Forget
    __declspec(dllexport) and use .DEF file instead.
     
    Maxim S. Shatskih, Nov 12, 2003
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.