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# Windows Form Application with 86x unmanaged dll

C# Windows Form Application with 86x unmanaged dll

Scheduled Pinned Locked Moved C#
helpcsharpdelphi
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.
  • Z Offline
    Z Offline
    Zeyad Jalil
    wrote on last edited by
    #1

    Dear All, I have an unmanaged DLL developed by Delphi language and it's support 86x and 64x and I want to use the DLL in my c# windows form application which use any cpu as a platform target but this error occurred "System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at ScaleDLL.frmMain.AclasSDK_Initialize(Pointer Adjuct) at ScaleDLL.frmMain.frmMain_Load(Object sender, EventArgs e) in F:\Dot Net Projects\Dlls\ScaleDLL\ScaleDLL\frmMain.cs:line 147" and we can't change the platform target to 86x because we use other libraries and it is not work when change the platform and we need to use this dll on the AnyCpU platform. Please help me ASAP. Thank You

    OriginalGriffO L 2 Replies Last reply
    0
    • Z Zeyad Jalil

      Dear All, I have an unmanaged DLL developed by Delphi language and it's support 86x and 64x and I want to use the DLL in my c# windows form application which use any cpu as a platform target but this error occurred "System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at ScaleDLL.frmMain.AclasSDK_Initialize(Pointer Adjuct) at ScaleDLL.frmMain.frmMain_Load(Object sender, EventArgs e) in F:\Dot Net Projects\Dlls\ScaleDLL\ScaleDLL\frmMain.cs:line 147" and we can't change the platform target to 86x because we use other libraries and it is not work when change the platform and we need to use this dll on the AnyCpU platform. Please help me ASAP. Thank You

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      It's not simple, not at all. Because you are using 64 bit libraries already, you can't access 32 bit libraries on the same process - even if you compile for "any cpu" that doesn't mean that a process can "switch" dynamically between the two. If you want to cleanly use your legacy DLL, you will need to either convert everything else to x86, convert the legacy DLL to 64 bit, or ... start reading: Accessing 32-bit DLLs from 64-bit code | Reflections on IT[^] Do not expect this to be a clean, neat, and easy solution. And no, I've never needed to do it - so I can't help you here...

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • Z Zeyad Jalil

        Dear All, I have an unmanaged DLL developed by Delphi language and it's support 86x and 64x and I want to use the DLL in my c# windows form application which use any cpu as a platform target but this error occurred "System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at ScaleDLL.frmMain.AclasSDK_Initialize(Pointer Adjuct) at ScaleDLL.frmMain.frmMain_Load(Object sender, EventArgs e) in F:\Dot Net Projects\Dlls\ScaleDLL\ScaleDLL\frmMain.cs:line 147" and we can't change the platform target to 86x because we use other libraries and it is not work when change the platform and we need to use this dll on the AnyCpU platform. Please help me ASAP. Thank You

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        [Interprocess Communication Between 32-bit and 64-bit Applications (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203(v=vs.85).aspx)

        "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

        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