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#
  4. Platform Invoke (pinvoke)

Platform Invoke (pinvoke)

Scheduled Pinned Locked Moved C#
csharpc++mcpdata-structureshelp
2 Posts 2 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
    gmhanna
    wrote on last edited by
    #1

    Hi, I'm trying to call a method that resides in a .DLL that was built with the Watcom C/C++ 10.6 compiler. The method was exported and the compiler gave it the modifies my name with an underscore and stack length. IE: ProcAuthorizationWeb becomes _ProcAuthorizationWeb@4 because it accepts a 4 byte pointer. I have the following code setup: [DllImport("mcp.dll")] public static extern bool _ProcAuthorizationWeb(ref CreditCardStruct CreditCardStruct); ..... _ProcAuthorizationWeb(ref CreditCardStruct); But I get the following error: [EntryPointNotFoundException: Unable to find an entry point named _ProcAuthorizationWeb in DLL mcp.dll.] The compiler is exporting it as _ProcAuthorizationWeb@4 so I thought I might create an export alias via: '_ProcAuthorizationWeb'='_ProcAuthorizationWeb@4' in the Linker/Binder, but that gave the same error. If I put the @4 at the end of the exported name, the .NET compiler gives me an error. Any ideas on how to call the method within the .DLL? Is there a way to see the actual exported names in the .DLL? Thank you, Glenn

    C 1 Reply Last reply
    0
    • G gmhanna

      Hi, I'm trying to call a method that resides in a .DLL that was built with the Watcom C/C++ 10.6 compiler. The method was exported and the compiler gave it the modifies my name with an underscore and stack length. IE: ProcAuthorizationWeb becomes _ProcAuthorizationWeb@4 because it accepts a 4 byte pointer. I have the following code setup: [DllImport("mcp.dll")] public static extern bool _ProcAuthorizationWeb(ref CreditCardStruct CreditCardStruct); ..... _ProcAuthorizationWeb(ref CreditCardStruct); But I get the following error: [EntryPointNotFoundException: Unable to find an entry point named _ProcAuthorizationWeb in DLL mcp.dll.] The compiler is exporting it as _ProcAuthorizationWeb@4 so I thought I might create an export alias via: '_ProcAuthorizationWeb'='_ProcAuthorizationWeb@4' in the Linker/Binder, but that gave the same error. If I put the @4 at the end of the exported name, the .NET compiler gives me an error. Any ideas on how to call the method within the .DLL? Is there a way to see the actual exported names in the .DLL? Thank you, Glenn

      C Offline
      C Offline
      Chua Wen Ching
      wrote on last edited by
      #2

      Hi, You can do this. [DllImport("mcp.dll", EntryPoint="_ProcAuthorizationWeb@4", SetLastError=true)] internal static extern bool _ProcAuthorizationWeb(ref CreditCardStruct CreditCardStruct); Hope it helps. Cheers. Regards, Chua Wen Ching Visit us at http://www.necoders.com

      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