operator new[] fails in DLL when being called from within VB6 process



Hi,

I have written a DLL in C/C++ which is used by a VB6 program. Everything works fine unless the DLL uses the operator new[] - e.g.

  m_pBuffer = new CHAR[ dwApproxPayloadLen ];

then an Access Violation Exception is thrown within ntdll!_RtlAllocHeap.

Calling
  CFoo *f = new Cfoo()
works just fine - only arrays will not work.

The same code works just fine when being called from a C/C++ program.

Is there something special about calling CRT functions when my lib is loaded into a VB6 process? Maybe VB6 does not initialize the CRT as it does not use it or something like that?

Thanks in advance,
  Jo
.



Relevant Pages

  • Re: PowerBASIC
    ... PB allows to bypass some limitations of VB6 (pointer arithmetics, ... calling functions by their addresses, calling DLLs using calling ... pretty active in the PB forums, ...
    (microsoft.public.vb.general.discussion)
  • Re: VB DLL Accessed by Multihreaded Application
    ... VB6 is not thread safe with MTA threads, ... calling the CreateThread API is not supported in VB6 code. ... It should be OK to make calls to VB6 DLLs from different STA threads. ...
    (microsoft.public.vb.com)
  • C# calling .dll and returning VBA.CollectionClass
    ... I've found from Microsoft that .NET cannot understand these types of ... collections and only VB6 can read them. ... out by casting. ... be calling dll's which return VBA.CollectionClasses... ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: VB6 and VS .NET 2005 problem
    ... > VB6 program worked successfully with assembly till I installed Visual ... Even though your problem is calling the routine from VB6 you might do better ... for one platform will be meaningless in the other. ... When VB.Net was released Microsoft created new newsgroups ...
    (microsoft.public.vb.general.discussion)
  • TRANS/ROLLBACK Using ADO
    ... I'm in the process of writing an update function within a VB6 application. ... each item into the table by calling my SP. ... how does this work by having an ADO BeginTrans within my VB6 code ...
    (microsoft.public.vb.database)