I’m trying to test the Async calls for some of my services, as they take a lot to complete. First I generated the C++Builder units but there are a lot of syntax errors and some other problems (for instance, the generated classes are abstract as they appear to be missing some function calls, GetBusy is an example) and I’m not quite sure how to fix them.
So, I tried with the Delphi units but I still get units that can’t be compiled:
The generated unit has always “unit DataAbstract4_Async;” as the first line.
Once fixed this, I get errors about undeclared identifiers.
I don’t know if I’m doing something incorrect when generating the units? I’m creating them with Service Builder, version 8.1.87.1147.
I’m sending the RODL file by email so you can try it there, but I don’t have anything special on it: I would expect that any non-trivial RODL file would create the same issues.
it’s a reason for naming units as DataAbstract4_*.
this tag (Includes) is designed for using in special cross-platforms rodls and shouldn’t used in usual rodls.
so I recommend to remove it for preventing future problems.
Ok, I have removed the DataAbstract include (I guess it was there from some earlier tests).
Did you manage to see also the C++Builder issues? I’m most interested in the C++Builder units than the Delphi ones, as all my apps are C++Builder apps.
[bcc32 Error] SMartisServer_Async.h(159): E2293 ) expected
[bcc32 Error] SMartisServer_Async.h(159): E2450 Undefined structure 'TGrabacionesInfo_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(159): E2034 Cannot convert 'const _di_IROMessage' to 'TGrabacionesInfo_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(160): E2315 'QueryInterface' is not a member of 'TGrabacionesInfo_AsyncProxy', because the type is not yet defined
[bcc32 Error] SMartisServer_Async.h(349): E2293 ) expected
[bcc32 Error] SMartisServer_Async.h(349): E2450 Undefined structure 'TDifusorasInfo_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(349): E2034 Cannot convert 'const _di_IROMessage' to 'TDifusorasInfo_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(350): E2315 'QueryInterface' is not a member of 'TDifusorasInfo_AsyncProxy', because the type is not yet defined
[bcc32 Error] SMartisServer_Async.h(475): E2293 ) expected
[bcc32 Error] SMartisServer_Async.h(475): E2450 Undefined structure 'TClientServices_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(475): E2034 Cannot convert 'const _di_IROMessage' to 'TClientServices_AsyncProxy'
[bcc32 Error] SMartisServer_Async.h(476): E2315 'QueryInterface' is not a member of 'TClientServices_AsyncProxy', because the type is not yet defined
Yes, those are ones. If you fixe some of them, for instance, if you move the TGrabacionesInfo_AsyncProxy definition before so it is defined, then you will get the pure virtual class error.
I ask because I tried to generate the async units from the ServiceBuilder app, not the IDE, so patching the IDE packages won’t solve the ServiceBuilder codegen.
I’m downloading and will install the update ASAP and try, but, if it didn’t make, is there a way to get the SB app updated with this?
I’ve installed the latest version and applied the patches you send, but… would it be possible to get the original templates, instead of the compiled res file?
I say this because there is a problem with the templates as provided: the Intf.cpp unit lacks the #pragma package(smart_init), which produces linker errors. I can’t fix that manually as that unit is regenerated everytime.
There is also a missing BCB define in the Synapse packages, which produces a synsock.hpp header incorrectly. Even with that define there are several stuff that needs to be commented on that header. I am not using Synapse transports anymore (as far as I know), but the IpTcpServer includes IpAsyncSocket and that includes the synsock unit.
I haven’t tested the async codegen, just recompiling my projects with the latest version.
Ok, my bad. The IpTCPTransport is (or depends on) the Synapse transports. I’ve changed it to the Indy one, and hopefully I won’t have to worry about the synapse units (and the AV when closing the server) anymore.
they are put into RemObjects SDK for Delphi\Source\CodeGen2\Templates folder. you need to update *.cpp/*.h files, recompile Templates.rc and then recompile RemObjects_Server_IDE_D*.dpk
Yes, I have recompiled the templates a few times before when trying to solve the issues I saw. But I don’t see the source templates in the zip you passed, only the compiled res file.
any Visual Studio can edit .RES so extracting of template.intf.cpp from .RES isn’t a problem.
also with Visual Studio you can replace template.intf.cpp resource inside ROSBBCB.dll so changes will be appeared in SB.
I’ve attached changed files: Templates.zip (7.6 KB)
I made some other changes over the last ones you sent me, that I’m posting here.
Basically:
changed the #includes to use the Framework.Unit patter used in the latest versions. Being that you mention support for C++Builder from XE and up, this shouldn’t be a problem.
changed the async unit to add the _asnyc postfix to the unit name in the #include and the header guard.
added the #pragma package_init that I mentioned earlier.
I could compile the async unit without problems, but I haven’t implemented yet using it in my app. If I found something I let you know.
There are still problems with the Async units for C++Builder.
As they are right now, with the latest changes, they compile fine, but when trying to use them I get the Exception declared in the Co…::Create function, to create the Service. The exception is the one defined in the async.h template around line 242.
I figured that the problem would be that the AsyncProxy doesn’t have the interface of the Service, just the TROAsyncProxy (as the Delphi generated unit does) So I added the interface of the service to the template (around line 122 of the async.h template) but then when compiling I get a compiler error
E2352 Cannot create instance of abstract class 'TGrabacionesInfo_AsyncProxy'
E2345 Class 'TGrabacionesInfo_AsyncProxy' is abstract because of '__fastcall IROAsyncInterface::GetBusy() = 0'
And certainly, there are several pure virtual functions on the IROAsyncInterface class, which should be implemented somewhere, but I don’t know what’s the correct step forward. Or maybe the AsyncProxy class shouldn’t inherit from the Interface of the service, but the Delphi code does and it does make sense to do so, and doing that, even if it compiles, it can’t be used on runtime because of the exception mentioned above.