Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why Visual C++ generates other function name, but I use extern "C"

Why Visual C++ generates other function name, but I use extern "C"

Scheduled Pinned Locked Moved C / C++ / MFC
c++delphitoolshelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gasanov Tagir
    wrote on last edited by
    #1

    Who know, why Visual C++ generates other function name, but I use extern "C" I use Visual C++ 2003 and try to export function from DLL. I declare function: extern "C" __declspec(dllexport) char* __stdcall GetUserFromAdir(HWND ParentWindow); When I view DLL by TDUMP (TDUMP is a utility from Borland Delphi), I see, my function GetUserFromAdir has other name (_GetUserFromAdir@4) How shall I solve this problem?

    D 1 Reply Last reply
    0
    • G Gasanov Tagir

      Who know, why Visual C++ generates other function name, but I use extern "C" I use Visual C++ 2003 and try to export function from DLL. I declare function: extern "C" __declspec(dllexport) char* __stdcall GetUserFromAdir(HWND ParentWindow); When I view DLL by TDUMP (TDUMP is a utility from Borland Delphi), I see, my function GetUserFromAdir has other name (_GetUserFromAdir@4) How shall I solve this problem?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Gasanov wrote: How shall I solve this problem? What problem? The "@4" indicates the size of the parameters (in bytes). Had your function used void, you would see "@0" instead. I think if you use the __stdcall calling convention, it will decorate the name. Use the .def file like Blake suggests to undecorate the name.


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      B 1 Reply Last reply
      0
      • D David Crow

        Gasanov wrote: How shall I solve this problem? What problem? The "@4" indicates the size of the parameters (in bytes). Had your function used void, you would see "@0" instead. I think if you use the __stdcall calling convention, it will decorate the name. Use the .def file like Blake suggests to undecorate the name.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        I think he expects the completely undecorated name, so that GetProcAddress can work. I usually do not add the 'dllexport' part and put the undecorated name into a DEF file. Always works for me.

        G 1 Reply Last reply
        0
        • B Blake Miller

          I think he expects the completely undecorated name, so that GetProcAddress can work. I usually do not add the 'dllexport' part and put the undecorated name into a DEF file. Always works for me.

          G Offline
          G Offline
          Gasanov Tagir
          wrote on last edited by
          #4

          Thank's. When I exported, by using .DEF file, it work

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups