Board index » cppbuilder » DLL: Delphimm.dll vs. Dcbmm.dll

DLL: Delphimm.dll vs. Dcbmm.dll

I am trying to use a Dll created in BCB within Delphi3.0. Dealing with
Delphi long strings I need to use the special memory manager. Now, in
BCB project I use bcbmm.lib included in my project, while in Delphi
project I use the unit Sharemem. Doesn't quite work and I cannot step in
my BCB code from Delphi environment. From Delphi I am passing in BCB dll
an alias name (as a string-AnsiString) and in the dll I am trying to
"Connect: a TDatabase component using this alias. The error I get is
"Out of memory"!
I tried to do the same thing from a CBuider application (calling the dll
and connecting to the database) and it worked perfectly.
Is there something to do with the delphimm versus bcbmm?

Thank you.

Luchian

 

Re:DLL: Delphimm.dll vs. Dcbmm.dll


Hi Luchian,

Quote
> I am trying to use a Dll created in BCB within Delphi3.0. Dealing with
> Delphi long strings I need to use the special memory manager. Now, in
> BCB project I use bcbmm.lib included in my project, while in Delphi
> project I use the unit Sharemem.

If your DLL talks to C++Builder then it needs to load BCBMM.DLL, but when
it talks to Delphi it needs to load DELPHIMM.DLL instead. I had the same
problem when writing (binary compatible) Expert/Wizard DLLs that had to
run in both environments, i.e. loading BCBMM.DLL or DELPHIMM.DLL depending
on which IDE loaded the DLL.

The only fix I could think of was to rewrite the ShareMem unit entirely,
to make sure it first finds out which environment (Delphi or C++Builder)
is loading the DLL, then then loading BCBMM.DLL or DELPHIMM.DLL depending
on that answer. I guess you can write a similar piece of C++ prologue code
for you case...

Anyway, the description and full source code for my new ShareMem unit
(that works with 32-bits Delphi 2.x, 3.x and C++Builder) is in the paper
"Writing Delphi Wizards" published on my website at www.drbob42.com.

Groetjes,
          Bob Swart (aka Dr.Bob - www.drbob42.com @ 207.19.106.213)

Re:DLL: Delphimm.dll vs. Dcbmm.dll


Hi Bob,
Thanks a lot. That was awesome - it saved me a lot of trouble. And it
was even easier then you thought: CBuilder (a nice product) was able to
compile the sharemem.pas code no problem (I mean I took advantage of the
fact that CBuilder compiles Delphi code and just added the unit to my
project).

Bob Swart (aka Dr.Bob) wrote:

Quote
> Hi Luchian,

> > I am trying to use a Dll created in BCB within Delphi3.0. Dealing
> with
> > Delphi long strings I need to use the special memory manager. Now,
> in
> > BCB project I use bcbmm.lib included in my project, while in Delphi
> > project I use the unit Sharemem.

> If your DLL talks to C++Builder then it needs to load BCBMM.DLL, but
> when
> it talks to Delphi it needs to load DELPHIMM.DLL instead. I had the
> same
> problem when writing (binary compatible) Expert/Wizard DLLs that had
> to
> run in both environments, i.e. loading BCBMM.DLL or DELPHIMM.DLL
> depending
> on which IDE loaded the DLL.

> The only fix I could think of was to rewrite the ShareMem unit
> entirely,
> to make sure it first finds out which environment (Delphi or
> C++Builder)
> is loading the DLL, then then loading BCBMM.DLL or DELPHIMM.DLL
> depending
> on that answer. I guess you can write a similar piece of C++ prologue
> code
> for you case...

> Anyway, the description and full source code for my new ShareMem unit
> (that works with 32-bits Delphi 2.x, 3.x and C++Builder) is in the
> paper
> "Writing Delphi Wizards" published on my website at www.drbob42.com.

> Groetjes,
>           Bob Swart (aka Dr.Bob - www.drbob42.com @ 207.19.106.213)

Other Threads