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. C# and DLL calling

C# and DLL calling

Scheduled Pinned Locked Moved C#
helpannouncementcsharpdebuggingtutorial
3 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.
  • C Offline
    C Offline
    Ceri
    wrote on last edited by
    #1

    Hi, I seem to have a problem with a debug version of a DLL that i am calling. It enteres the function OK and goes to the end but when the function returns it tries to store the return value of the functoin in the register ESI from EDX. Visual C# then throws an access violation error. It works fine in release mode and uses the same registers. Has anybody seen this before and know how to resolve the issue. Thanks Ceri

    P S 2 Replies Last reply
    0
    • C Ceri

      Hi, I seem to have a problem with a debug version of a DLL that i am calling. It enteres the function OK and goes to the end but when the function returns it tries to store the return value of the functoin in the register ESI from EDX. Visual C# then throws an access violation error. It works fine in release mode and uses the same registers. Has anybody seen this before and know how to resolve the issue. Thanks Ceri

      P Offline
      P Offline
      Paul Riley
      wrote on last edited by
      #2

      Ceri wrote: Has anybody seen this before and know how to resolve the issue. Not exactly but I have had similar problems before, there are often vast differences between debug and release versions that you don't see. For example, I've written DLLs for Windows Installer using VC++ which work fine in debug mode and not in release mode. When I switched the release mode optimisation off, it worked fine. If possible, it's worth looking at the differences in the commandline options for the DLL in release and debug mode and adjusting them until they both act the same way. Then at least you'll know what is causing the problem. Paul Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop

      1 Reply Last reply
      0
      • C Ceri

        Hi, I seem to have a problem with a debug version of a DLL that i am calling. It enteres the function OK and goes to the end but when the function returns it tries to store the return value of the functoin in the register ESI from EDX. Visual C# then throws an access violation error. It works fine in release mode and uses the same registers. Has anybody seen this before and know how to resolve the issue. Thanks Ceri

        S Offline
        S Offline
        Stephane Rodriguez
        wrote on last edited by
        #3

        Don't see the relation with C#, appart the fact C# is hosting your client. Try compiling the DLL by changing the signature of methods (__cdecl, __fastcall, ...) : Project settings / C/C++ tab / code generation / calling convention. From what I remember, the return value is always stored in EAX.


        How low can you go ?
        (MS retrof_u_ck)

        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