Including user defined template in a project using Clarion 6.3


How can I Include a user defined template in a project .prj using Clarion 6.3


Hi, templates are for use within an application, so you wouldn’t include them in the prj.

Templates will generate code within that application, be it globally with a global extension template or locally with either a local extension template or code template.

So are you sure your question is about templates or code?


Hello Mark,

Although I have experience in clarion programming for more than 22 years and created hundreds of solutions in deferent areas, but never used projects or classes. Now I am trying to fill the gaps in my knowledge by trying to understand practically the difference between apps and projects, and the same the difference between classes and templates (when it comes to pure functions which do not require template commands).

So I asking such questions which could be basics for many but not for me.

You answer was clear and sufficient.

Thank you and best regards

Bruce Johnson did a comprehensive series of webinars on templates.

Part 1

Part 2

Part 3

Part 4

Part 5

1 Like

Nice. Thanks a lot.


I’m guessing you are looking to wrap a class in a template?

If so, do you have any of the Capesoft templates? If you do, more than likely you will have access to two files Bruce ships. Cape01.tpw and Cape02.tpw. They will be in your Accessory\template\win directory of your clarion folder.

Cape01.tpw is the documentation for how to use the two files to wrap a template around a class. It handles generating EXP in a multi app solution as well as creating embed points in local procedures that use the class.

I understand it takes a little while to understand everything in play, but that will be a start.

There will be other things you will probably need to add to your class inc file. For an understanding of that, if you have it, you can take a look at, where the class is defined with the following.

StringTheory        Class(), type, Module('StringTheory.clw'), Link('StringTheory.clw',StringTheoryLinkMode),DLL(StringTheoryDLLMode)

Of note here is that the class is defined as a Type. This means that the class is defined as a TYPE definition, and to use it the programmer has to derive from that type. That is done in a few different ways

MyClass     CLASS,TYPE

MyOtherClass        MyClass

MyOtherClassReference       &MyClass

MyOtherClassDerived CLASS(MyClass)

The Second example, MyOtherClassReference will not exist to be called until you specifically set the reference. For the most part this will look like in your code

  MyOtherClassReference &= NEW(MyClass)
!...Later in code you will need to dispose the class from memory to  stop a memory leak

The other thing to note are the LINK and DLL modes, these are instructing the linker/compiler on how to link/compile in the class into your application (.app). The DLL mode instructs the compiler that you specifically want the code to be shared from a specific DLL, usually your DATA app in clarion terms.

Cape01.tpw and Cape02.tpw do all the magic in the application, but your Class definition will have to follow the above.

In StringTheory, you will note StringTheoryLinkMode and StringTheoryDLLMode, these are PRAGMA values you either set manually, or more than likely let the template do the work for you, which I think Cape01 and 02 do for you.

Obviously a lot to learn here, and watching the videos Don posted will help a little with template writing. It’s not going to be a 5 min zero to hero exercise, but that comes with a lot of trial and error.

Good luck

I will try that.

Thank you.