xsharp.eu • Shared class library
Page 1 of 1

Shared class library

Posted: Mon May 06, 2024 12:32 am
by RolWil
Hi all,

I have something you'll no doubt be able to help me with:

Goal: create a Class shared by a dozen or so projects (the Class provides the functionality to create reports in HTML format).

Question: how to accomplish this (I use the Harbor dialect). I see there are class templates, but they create DLL’s. Is there a way the class code can be pulled in at compile time?

Thanks folks,
Roland

Re: Shared class library

Posted: Mon May 06, 2024 3:20 am
by wriedmann
Hi Roland,
to have a class shared by several projects you have to create a DLL and to include it in the references of every application.
This library can be part of the same project as the executable or of a different project.
There are other, more advanced possibilities to share code, but they have some drawbacks and need much more attention.
Wolfgang

Re: Shared class library

Posted: Mon May 06, 2024 8:11 am
by Chris
Hi Roland,

If the class consists of one or a few prg files it is not difficult, you just need to add the file in all of your apps/projects that need it, as a linked file. In order to do that in XIDE, when you add the file, just say "No" when asked to copy it to the app folder. I think Wolfgang refers to the complexity of making sure all your apps use the compiler options that this class requires, but I think that's manageable.