Error PrintPreview b

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Error PrintPreview b

Post by Chris »

Hi Karl,
FFF wrote: Tue Feb 18, 2025 9:47 am Re the "loaded when needed": Is that new, or somewhere documented?
That's only about those specific ReportPro dlls, there's code in report pro that loads them if they are needed. Same as with XSharp.MacroCompiler.dll and XSharp.Rdd.dll, normally you must not reference those directly in your apps (unless you need to directly use types from there in very special cases), instead the X# runtime loads them whenn needed (when opening a dbf or macro compiling for the first time).
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 5041
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Error PrintPreview b

Post by robert »

Karl, Chris
Also, the language DLLs have no code, only (native) resources.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Error PrintPreview b

Post by Chris »

Hi Martin,

Tudorf wrote: Tue Feb 18, 2025 11:05 am Thank you. The preview is running.

Glad you have it working in now! But with so many unneeded, duplicates and from different places references, you will definitely have issues in the future, especially when you will want to use a newer X# version. I suggest to do this:

- Remove all references from all libraries and the main app, except for "System" and the few ones of bBrowser and Report Pro (and FreeImageNET.dll, if you need this indeed).

- Then add only the needed ones, from the correct places. In all libraries and the app, you need to add those references (for the app properties window, References page):

"GAC" page:
-------------
XSharp.Core
XSharp.RT
XSharp.VO
VOGUIClasses
VORDDClasses
VOSystemClasses
VOWin32APILibrary

"Project" page:
-----------------
Here you add references to your own libraries in the same project. Each library/app needs different ones:

BS_Server_V4: does not need project references
BS_Util_V4: Needs a reference to BS_Server_V4
BS_report_V4: Needs references to both of the above libraries
BS_V4 (the main app/exe): Needs references to all three above libraries

It's much better to do this this way (via the Project page), instead of adding a reference directly to the libraries as dll files on disk, because it lets the IDE automatically resolve where on disk they are generated by the compiler, no matter the configuration (Debug/Release) used, or what the main project folder is.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Tudorf
Posts: 50
Joined: Wed Feb 08, 2023 3:43 pm

Re: Error PrintPreview b

Post by Tudorf »

Hello Chris

I have adapted everything as I understood it.

Unfortunately, the programme crashes again during the preview without an error message.

What is missing?
Tudorf.jpg
Martin
User avatar
robert
Posts: 5041
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Error PrintPreview b

Post by robert »

Martin,
Your main program does not reference the ReportPro Base and ReportPro Runtime DLLs

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Error PrintPreview b

Post by Chris »

Hi Martin (and others),

Just to explain further the problem and solution, ReportPro (and other tools) rely on _INIT1 (or 2, or 3) which are automatically called at app startup, in order to initialize some variables or do some necessary preparation.

The way this has currently been implemented in X# under the hood, is that for each library referenced by an application, the compiler emits some special code that calls those procedures, before the FUNCTION Start() of the app is executed. But if a library is not used (referenced) directly by an app and is only used indirectly as a reference of another library, then the compiler is not aware of this when compiling the main app and does not include that library in the initialization.

Adding such libraries as references also to the main app (even if the main app does not directly need them) fixes this problem, but we are discussing also other alternative ways to implement this without needing this workaround.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply