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. COM
  4. Re: Call C# DLL using C++ - "Not enough storage is available to complete this operation" [modified]

Re: Call C# DLL using C++ - "Not enough storage is available to complete this operation" [modified]

Scheduled Pinned Locked Moved COM
debuggingcsharpc++helpquestion
2 Posts 1 Posters 2 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.
  • M Offline
    M Offline
    mla154
    wrote on last edited by
    #1

    Hello, I want to create a C# DLL that passes out a string as a parameter. I have tried this (partial code): [C# Code] public interface iInterface1 { [System.Runtime.InteropServices.DispId(13)] void Call13( [System.Runtime.InteropServices.In] [System.Runtime.InteropServices.Out] [System.Runtime.InteropServices.MarshalAs( System.Runtime.InteropServices.UnmanagedType.BStr)] ref string s1); [System.Runtime.InteropServices.DispId(17)] void Call17( [System.Runtime.InteropServices.In, System.Runtime.InteropServices.Out, System.Runtime.InteropServices.MarshalAs( System.Runtime.InteropServices.UnmanagedType.LPWStr)] ref System.String s1); } [C++ Code] BSTR s; m_int0.Call13(&s); [C++ Code] LPWSTR s2; m_int0.Call17(&s2); The programs compile, but do not run: The C++ call to Call13 gives me the message "Not enough storage is available to complete this operation". The C++ call to Call17 in Debug mode shows that there is a breakpoint in the program: "This may be due to a corruption of the heap, and indicates a bug in go2.exe or any of the DLLs it has loaded." Does anyone have any ideas? Regards, Mike modified on Wednesday, April 15, 2009 10:23 AM

    M 1 Reply Last reply
    0
    • M mla154

      Hello, I want to create a C# DLL that passes out a string as a parameter. I have tried this (partial code): [C# Code] public interface iInterface1 { [System.Runtime.InteropServices.DispId(13)] void Call13( [System.Runtime.InteropServices.In] [System.Runtime.InteropServices.Out] [System.Runtime.InteropServices.MarshalAs( System.Runtime.InteropServices.UnmanagedType.BStr)] ref string s1); [System.Runtime.InteropServices.DispId(17)] void Call17( [System.Runtime.InteropServices.In, System.Runtime.InteropServices.Out, System.Runtime.InteropServices.MarshalAs( System.Runtime.InteropServices.UnmanagedType.LPWStr)] ref System.String s1); } [C++ Code] BSTR s; m_int0.Call13(&s); [C++ Code] LPWSTR s2; m_int0.Call17(&s2); The programs compile, but do not run: The C++ call to Call13 gives me the message "Not enough storage is available to complete this operation". The C++ call to Call17 in Debug mode shows that there is a breakpoint in the program: "This may be due to a corruption of the heap, and indicates a bug in go2.exe or any of the DLLs it has loaded." Does anyone have any ideas? Regards, Mike modified on Wednesday, April 15, 2009 10:23 AM

      M Offline
      M Offline
      mla154
      wrote on last edited by
      #2

      http://books.google.com/books?id=ZDin4axsYoEC&pg=PA398&lpg=PA398&dq=call+managed+code+stringbuilder&source=bl&ots=x45eJ7Ns__&sig=bGDq4U5_urIqdmvfqmLmWkXgaeY&hl=en&ei=uC_mSePgLYuwMqq27YwJ&sa=X&oi=book_result&ct=result&resnum=2#PPA374,M1[^]

      Regards, Mike

      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