You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function getController(const AMVC: TMVCEngine): TMVCControllerClass; stdcall;
exports
getController;
implementation
uses
SysUtils, MVCFramework.Session, System.JSON;
function getController(const AMVC: TMVCEngine): TMVCControllerClass; stdcall;
begin
MVC := AMVC;
Result := TAdminCntrl;
end;
...`
In AppServer ... APath := GetDirectoryName(APath); Res := System.SysUtils.FindFirst(APath + '*.dll', faAnyFile, SR); try while Res = 0 do begin dll := LoadLibrary(PWideChar(APath + SR.Name)); if dll <> 0 then begin get_func := GetProcAddress(dll, 'getController'); FMVC.AddController(get_func(FMVC)); end; Res := FindNext(SR); end; finally System.SysUtils.FindClose(SR); end; ...
When you call this controller's method, the error "Invalid class typecast".
Thanks.
The text was updated successfully, but these errors were encountered:
Hi.
How to use the TMVCController class in DLL?
In DLL
`...
TAdminCntrl = class(TMVCController)
end;
function getController(const AMVC: TMVCEngine): TMVCControllerClass; stdcall;
exports
getController;
implementation
uses
SysUtils, MVCFramework.Session, System.JSON;
function getController(const AMVC: TMVCEngine): TMVCControllerClass; stdcall;
begin
MVC := AMVC;
Result := TAdminCntrl;
end;
...`
In AppServer
... APath := GetDirectoryName(APath); Res := System.SysUtils.FindFirst(APath + '*.dll', faAnyFile, SR); try while Res = 0 do begin dll := LoadLibrary(PWideChar(APath + SR.Name)); if dll <> 0 then begin get_func := GetProcAddress(dll, 'getController'); FMVC.AddController(get_func(FMVC)); end; Res := FindNext(SR); end; finally System.SysUtils.FindClose(SR); end; ...
When you call this controller's method, the error "Invalid class typecast".
Thanks.
The text was updated successfully, but these errors were encountered: