PatV 1 Posted September 25, 2019 (edited) Hi, could someone tell me what's wrong here, I'm returning an IInterface as needed so ... [dcc32 Error] clsInit.pas(313): E2250 There is no overloaded version of 'SetThreadDataFactory' that can be called with these arguments ( in OtlThreadPool ; TOTPThreadDataFactoryFunction = function: IInterface; ) function TFConfig.CreateThreadPool(aHandle : THandle ; aConfig : rConnectionConfig ; aValue: string) : iOmniThreadPool; begin result := otlThreadPool.CreateThreadPool(aValue); result.MaxExecuting := result.NumCores; result.SetThreadDataFactory ( function : IInterface begin result:=CreateConnectionPoolData(aHandle,aConfig); end );end; I have defined CreateConnectionPoolData as follow function CreateConnectionPoolData(const aHandle : THandle ; const aConfig : rConnectionConfig) : IInterface; var aPool : IConnectionPoolData; begin aPool := TConnectionPoolData.Create; aPool.WithHandle(aHandle).WithConnectionConfig(aConfig); result:=aPool; end; IConnectionPoolData = interface function WithHandle(const aValue : HWND) : IConnectionPoolData ; function WithConnectionConfig(aValue : rConnectionConfig) : IConnectionPoolData ; end; Thanks Patrick Edited September 25, 2019 by PatV update Share this post Link to post
Primož Gabrijelčič 223 Posted September 25, 2019 Ah, SetThreadDataFactory actually doesn't support taking an anonymous function as an argument. An oversight that I should fix in a future. So - pass a normal function or method name to SetThreadDataFactory, not an anonymous method. (And I will amend my answer to your previous question on that topic.) Share this post Link to post
PatV 1 Posted September 25, 2019 So, I can't pass function or method with parameters then ? Share this post Link to post