Using VB6 dll in Delphi app.

Tech-Archive recommends: Fix windows errors by optimizing your registry



I'm the VB programmer on this project, and another guy is doing the
Delphi part.

System info:
Windows XP SP2
MSVBVM60.dll version 6.0.97.82, dated 2/23/04

I am using this hack:
http://www.windowsdevcenter.com/pub/a/windows/2005/04/26/create_dll.html
to make a *windows standard* .dll with VB6. When I use it in another VB
app, using standard dll function calls, everything works great, the app
returns the values I expect, the logs are created, etc.

The trouble occurs when we try to use it in a Delphi app. After several
days of working with it, we can tell that it is getting into the
functions, but it appears that nothing which requires any kind of IO
from the dll is working, and throws Access violations in module
MSVBVM60.dll. A low level debugger shows that statements are executing
until we hit ones which require IO. This occurs whenever we try to
write to do debugging outputs such as writing to disk file, or pop up a
msgbox, and when we try to do real work such as make an OpenDatabase
call. If we only do internal processing (such as number crunching or
parsing the passed parameters), it works ok and returns what we expect.

We checked the obvious things:
we are using stdcall for the calling convention
the parameters are all aligned on 4-byte boundaries
variable types are compatible (VB long = Delphi Integer, etc)
DEP is set for "Essential windows programs and services only"

We use many of the structure (user-defined Types) definitions in other
working code, including a delphi dll used in VB, so we know they are
compatible.

One thing I'm not sure of is what I need in DllMain. Right now I've got
it always returning 1, but not doing any processing.

Any suggestions or pointers will be greatly appreciated. If it would
help, I can post source code as well...


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
.



Relevant Pages

  • Re: Using VB6 dll in Delphi app.
    ... to make a *windows standard* .dll with VB6. ... The trouble occurs when we try to use it in a Delphi app. ...
    (microsoft.public.vb.general.discussion)
  • Re: Borlands linux strategy ?
    ... What would be so awful for Borland, as a company, from a strategic perspective, to start a new product line that targets non-asp.net, non-windows development? ... My point is that if you try to port Delphi, and what makes Delphi Delphi, to another development platform, it will fail. ... This is the main point of my argument for why Delphi is and should remain a Windows development tool. ... It's hard for a software vendor to make any money from dev tools alone, especially in the ISV market. ...
    (borland.public.delphi.non-technical)
  • Re: Borlands linux strategy ?
    ... Sorry, it's the general mentality of Borland, and reinforced by users who ... believe that Delphi should just remain a windows platform tool. ...
    (borland.public.delphi.non-technical)
  • Re: A cross-platform vision for Delphi
    ... Delphi IDE is simple: sometime the builds are so good, I mean SO GOOD, ... a tool that limits yourself to a 32-bit Windows platform. ... Great machine to install a modern Linux desktop. ... Now I credit Codegear ...
    (borland.public.delphi.non-technical)
  • Re: Borlands linux strategy ?
    ... the reason why Delphi can compete at all in the server-side market ... That's an extension to the opportunity for Borland. ... efforts depend on the notion that every developer includes Windows as ...
    (borland.public.delphi.non-technical)