BOOL32 __stdcall rptGetLastError(TRPT Engine, PRptErrorInfoC Info);
BOOL32 __stdcall rptGetVersion(int32_t* Major, int32_t* Minor, int32_t* Patch);
function rptGetLastError(const Engine: TRPT; Info: PRptErrorInfoC): LongBool; stdcall;
function rptGetVersion(Major, Minor, Patch: PInteger): LongBool; stdcall;
Purpose. rptGetLastError retrieves the most recent error — either a specific engine's own last recorded error, or (when Engine = nil) the calling thread's engine-*creation* ("boot") error, the only way to learn why rptCreateEngine itself failed since a failed creation returns no handle. rptGetVersion reports the compiled-in LumasReport engine version.
Description. Engine = nil always succeeds and returns the thread-local GBootError (which may itself be a "no error" sentinel if nothing has failed on this thread yet — RptOkError). A non-nil but invalid Engine handle still returns True with a synthesized RPT_E_BADHANDLE error filled into Info — "still give the caller something actionable" per an inline comment, rather than simply failing the call. A valid Engine returns Eng.Errors.GetLast — the engine's own real per-instance last-error slot, updated by every render/export/preview/print/plugin-load exception as documented above. rptGetVersion needs no engine or license at all — it's a pure compile-time-constant reporter (RPT_VER_MAJOR/MINOR/PATCH), and each of Major/Minor/Patch may independently be nil to skip that output.
Parameters.
| Parameter | Description |
|---|---|
Engine | nil = the calling thread's boot (creation) error; a valid handle = that engine's own last error; an invalid non-nil handle = a synthesized RPT_E_BADHANDLE. |
Info | Output: the structured error (code, source, location, message, hint). |
Major, Minor, Patch | *(GetVersion only)* Each independently nilable. |
Return value. rptGetLastError: True in effectively all cases (only a nil Info pointer or an internal exception returns False). rptGetVersion: True always (no failure path beyond an internal exception).
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Reporting
rptGetLastError
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.