Board index » delphi » Build with runtime packages + Access Violation

Build with runtime packages + Access Violation

Dear friends,

        I have an EXE that loads a DLL. Both are produced by Delphi 3.
When I build the EXE I dont check the option "build with runtime
packages", but when I build the DLL I check that option (the runtime
packages are listed at the end of the message). The DLL creates a couple
of forms.
        I load the library, one of its forms is showed, it is closed.
So far, so good. But, at the very ending of the execution of the EXE, I
receive the runtime erro message "Runtime error 216 at ...".
        If I build both (EXE and DLL) without checking "build with runtime
package", there is no problem.
        Does somebody know whats going on?

        Thanks,

Evandro

Run time packages:
VCLX30;VCL30;VCLDB30;VCLDBX30;INETDB30;INET30;VCLSMP30;QRPT30;TEEUI30;
TEEDB30;TEE30;DSS30;IBEVNT30;IP30

 

Re:Build with runtime packages + Access Violation


Hallo Evandro,

I can't say what is going on - I have only this explanation what runtime
packages are for:

If you compiled the exe and/or the DLL WITHOUT packages and without
sharemem, the exe and the dll use different instances of every routine
and every class. This means:
- when passing a pointer to any class from the exe/dll to each other,
all calls to "is" and "as" operators fails, because these operators
don't compare the classnames, but the pointers to the VMT.
- when passing heap allocated memory to each other and trying to free
them there, at best it throws a "EInvalidPointer" and at worst it
corrupts the heap, because both the exe and the dll uses their own
notebook of allocated heap

If you compile BOTH the exe and the dll WITH packages and sharemem, then
they both use the class implementations located in the various VCL bpls
and the heap manager dll.

Long speech, short answer: compile BOTH with packages.

HTH, Kay

VMT - virtual method table - table of pointers to virtual methods of a
class

Quote
Evandro Bacarin wrote:

> Dear friends,

>         I have an EXE that loads a DLL. Both are produced by Delphi 3.
> When I build the EXE I dont check the option "build with runtime
> packages", but when I build the DLL I check that option (the runtime
> packages are listed at the end of the message). The DLL creates a couple
> of forms.
>         I load the library, one of its forms is showed, it is closed.
> So far, so good. But, at the very ending of the execution of the EXE, I
> receive the runtime erro message "Runtime error 216 at ...".
>         If I build both (EXE and DLL) without checking "build with runtime
> package", there is no problem.
>         Does somebody know whats going on?

>         Thanks,

> Evandro

> Run time packages:
> VCLX30;VCL30;VCLDB30;VCLDBX30;INETDB30;INET30;VCLSMP30;QRPT30;TEEUI30;
> TEEDB30;TEE30;DSS30;IBEVNT30;IP30

Re:Build with runtime packages + Access Violation


Hi Kay,

        Thanks for your answer.

Quote
> Long speech, short answer: compile BOTH with packages.

> HTH, Kay

        In this case I have another problem: I will get two buttons in the task
bar: one button for the exe's form and another for the dlls form.
I cant get rid of the second button.

        Thanks,

Evandro

Re:Build with runtime packages + Access Violation


Hallo Evandro,

I'm not sure about this. Sounds as if your Dll had his own Application
instance. At the moment I don't have time to try for myself. Just an
suggestion: Change your dll to a package, add it to the list of runtime
packages, and use the dll-form-class directly.

HTH, Kay

Quote
Evandro Bacarin wrote:

> Hi Kay,

>         Thanks for your answer.
> > Long speech, short answer: compile BOTH with packages.

> > HTH, Kay

>         In this case I have another problem: I will get two buttons in the task
> bar: one button for the exe's form and another for the dlls form.
> I cant get rid of the second button.

>         Thanks,

> Evandro

Other Threads