Aurelius with UniDAC in a BPL

All weekend I'm trying to get Aurelius running in a modular environment but I hit a brick wall yesterday.

So I have an EXE that compiles with only RTL260.bpl and VCL260.bpl and this exe loads my own BPL. I need it that way to shut down the whole system as a windows service, replace some bpls and start it again. The database is Firebird 3 with UniDAC (latest). Everything works fine. I can restart the system and no memory leaks and nothing. 

Now I brought Aurelius into the system and tried to connect it. It works and I have access to the database. But when I try to shutdown the bpl, it always crashes. It looks like Aurelius tries to free the cloned connection and inside that connection to free up some transaction which fails.

If I do the same in a single exe file it works.
When doing exactly the same the loaded BPL, 
1.) I have to connect the source unidac connection before cloning it by calling "FConnection := TUniDacFirebird3Connection.CreateConnection;", otherwise I get an error about one of the connections of the transaction is not active.
So if I connect it, now I get 
2.) Crash when freeing the datamodule with the original connection, connected or not at this point.

Any ideas ? I'm running out of them :(


For your convenience I uploaded a sample project to zippyshare (only source, no exe included)

The WxServiceApp.exe (after compiling it) looks for the bpl (after compiling that one too) i the same directory. The project is configured that it only needs to be compiled (32bit debug) and run. 
The invalid pointer error when shutting down will appear after you press Start and then Stop.
The error about the "one of the connections in the transaction is not active" you need to comment out a line of code in uLoaderUnit.pas. I already marked the spot :)

Thanks for your time. 
Maybe this can help?

Trying to use “Disconnect mode” in UniDac to solve the transaction issue? 

It actually resolves the 2 problems I'm having. I tried a small db update and it's written nicely into the database. And I can shutdown the whole bpl and restart it without invalid pointer errors.

I also tried transaction handling and it works fine now. Thanks a lot for your fast answer.
Maybe you can make a remark in the documentation about it, it's  not very obvious :)

Thanks again, Wagner