You are not logged in.
Pages: 1
If I declare an interface service method with an enumerated return type which has the values specified, then I get an AV in TInterfaceFactory.Create at AddMethodsFromTypeInfo(aInterface). I guess this is from the lack of RTTI in Delphi enums with specified values. Not a problem for me but would be good to raise a specific exception. Using Delphi 11.2 and the latest pull of mORMot2.
Cheers, Bob
Offline
I use interface services with regular enumerate types as function result with no issue.
But of course, the framework needs RTTI.
So we indeed need regular enums with no forced values - what I call "regular" enumerate types.
Offline
It happens in the case of enumerated return type where the values are explicitly specified, e.g. TTestEnum = (enum1 = 1, enum2 = 2,...).
(Just saw your edited reply :-)) I realise there's no way round it - just it would be helpful to have an exception message.
Cheers, Bob
Last edited by rdevine (2023-02-24 17:20:37)
Offline
Does the following do what you expect?
Offline
Still getting a generic AV message (I can see the new exception in the code as I step through but it doesn't get there). For testing I'm using a VCL forms app with the following simple code in the form unit:
TTestEnum = (tteOne = 1,
tteTwo = 2);
ITestIntf = interface(IInvokable)
['{7F2B6047-D04B-488E-AA6D-03E184BE980A}']
function TestEnum: TTestEnum;
end;
....
initialization
TInterfaceFactory.RegisterInterfaces([TypeInfo(ITestIntf)]);
Offline
Pages: 1