How to Use Sample Code from CodeXchange
- PowerBuilder
- Bruce Armstrong
- Friday , 13 November 2026
- 35 Hits
- 0 Comments
Code posted to Appeon's CodeXchange is there to be reused: you can almost always put it in your own applications, commercial ones included. What changes from sample to sample is what you owe the author in return, and that depends on the license that comes with it. The obligations are small, but they're different when you ship code inside an application than when you republish it as a framework or as sample code of your own.
This article covers which terms apply to CodeXchange code, the three main families of license, and what each one asks of you in those two situations.
Which terms apply to CodeXchange code
The license file in the download wins. If a sample includes a license.txt, LICENSE or a license header in its source, those are the terms. Only when there's none do the site's default terms apply, and those defaults have changed over the years.
| Where the code came from | Terms when the sample has no license file |
|---|---|
| Appeon CodeXchange, posted under its current terms | Appeon's Additional Legal Terms: use, modify and redistribute "without restrictions of any kind" |
| Samples SAP moved from Sybase CodeXchange in 2015 | Many gained a license.txt during the move; check each download |
| Sybase CodeXchange, before 2015 | The CodeXchange Terms of Use: a limited, revocable license, for use with Sybase products |
Appeon's current terms
Anyone who submits code to Appeon's sites grants every user a worldwide, perpetual, irrevocable, royalty-free license to use, copy, modify, distribute and sublicense it. That grant works one of two ways:
- With a permissive license. If the author includes one (MIT, Apache 2.0 and so on), you use the code under that license, and its conditions apply.
- Without one. You can use the code "without restrictions of any kind", with no payment, permission or notice owed to anyone.
Authors keep their moral rights, including attribution, and waive them only against Appeon. In the United States those rights barely apply to software, so for code with no license file, crediting the author is a courtesy, not an obligation.
The original Sybase terms
Samples first posted on Sybase CodeXchange without a license file were covered by the site's Terms of Use. Other users got only a limited, non-exclusive, non-transferable and revocable license, for use with licensed Sybase products. Redistribution required keeping the author's copyright notices and marking your changes, and the license ended automatically if you broke those conditions.
Those terms still matter for code you copied before the samples moved, or that you're still distributing from an old download. When SAP moved the samples in 2015, many authors had a license file added.
The three families of license
Almost every open source license falls into one of three families. They differ in one thing: what you have to pass on when you pass the code on.
| Family | Examples | What it asks of you |
|---|---|---|
| Public domain or no restrictions | Unlicense, CC0, Appeon's no-license default | Nothing |
| Permissive | MIT, BSD, Apache 2.0, Boost | Keep the copyright notice and license text with the code; Apache 2.0 also asks you to mark changed files |
| Weak copyleft | LGPL, MPL, EPL, CPL | Changes to the licensed code itself stay open; your own code that uses it doesn't |
| Strong copyleft | GPL, AGPL | Any program you distribute that includes the code is distributed under the same license, with its source |
Public domain and "no restrictions" code carries no conditions at all. You can use it, change it and publish it under any terms you like, including your own copyright for your changes.
Permissive licenses let you do almost anything, including close the code inside a commercial product. Their one real condition is attribution: the original copyright notice and the license text must travel with the code wherever you send it as source.
Copyleft licenses keep code open. Weak copyleft applies to the licensed files or library, so you can link to it or include it from closed code, as long as you share your changes to the library itself. Strong copyleft reaches the whole program: distribute something built on GPL code and your program must be GPL too.
Licenses on CodeXchange vary, so check each download.
Using sample code in your own application
Putting sample code inside an application you build, whether it's for internal use or sold to customers, is the easy case. Your users get a compiled application, not the code, and most licenses ask very little of that.
Internal applications. If the application never leaves your organization, you aren't distributing the code, and none of these licenses asks anything of you, GPL included. The exception is the AGPL, which also counts letting people use the program over a network, such as a web application built with PowerServer. Keeping the original license file in your source tree is still good practice, so whoever maintains the code later knows its terms.
Applications you ship or sell. Here the family matters:
- Public domain or no license file: nothing is required. Credit the author if you like.
- Permissive: you don't have to publish your source. Include the copyright notice and license text somewhere your customers can see them, usually a third-party notices file in the install folder, a page in your documentation or an About box. Boost doesn't require even that for compiled code; MIT and Apache 2.0 are best read as requiring it.
- Weak copyleft (LGPL and similar): you can keep your own code closed. Keep the LGPL code separate (in PowerBuilder terms, in its own PBL and PBD), share any changes you make to it, include the license, and let customers replace that library with their own version.
- Strong copyleft (GPL): distributing an application that contains GPL code makes the whole application GPL, so you must offer your customers its full source under the GPL. If that's not acceptable, don't use the code, or ask the author for different terms.
In every case, don't remove or rewrite copyright notices in the code itself. Changing a variable name is fine; replacing the author's name with yours is not.
Redistributing sample code as a framework or sample
Publishing the code itself, as part of a framework, a library, a tool or your own sample, is the case that carries real obligations, because the people you hand it to get the source. They need the same information you got: who wrote it and on what terms.
- Public domain or no license file: you can publish it under any terms, even claim copyright in your own changes. Saying where it came from is still honest and expected, and claiming to be its original author is not.
- Permissive:
- Keep the original copyright notice in every file that contains the code, and ship the license text with your package.
- Under Apache 2.0, add a note to each file you changed saying that you changed it.
- You can add your own copyright line for your changes, and license your own additions however you like.
- You can't relabel the original code as "all rights reserved" or forbid others from redistributing it; the license already lets everyone do that.
- Weak copyleft: the licensed code, with your changes, stays under its license, with its source. Your own framework code around it can use other terms, as long as it's kept separate.
- Strong copyleft: your whole framework or sample becomes GPL if it includes the code.
If you republish with a different license from the original, the original code keeps its license. A framework that contains MIT or Apache 2.0 code under a proprietary license is fine, provided the notices and license text for that code go with it.
At a glance
| License family | In an application you ship or sell | Republished as a framework or sample |
|---|---|---|
| Public domain or no license file | Nothing required | Any terms; don't claim original authorship |
| Permissive (MIT, Apache 2.0, BSD) | Copyright notice and license in your notices file or About box | Keep the notices in the files, include the license, mark changes (Apache), no "all rights reserved" on the original code |
| Weak copyleft (LGPL, MPL, CPL) | Keep it separate, include the license, share changes to it | The library and your changes stay under its license, with source |
| Strong copyleft (GPL) | Your whole application is GPL, with source | Your whole framework or sample is GPL |
Before you reuse a sample:
- Open the download and look for
license.txt,LICENSEor a license header in the source. - Note the author, the license and where you got it, in your own source or a notices file.
- Leave the author's copyright notices in the code.
- If you'll republish the code, include the license text and mark what you changed.
A note before you rely on this
This is a practical guide, not legal advice. License terms, and how courts read them, vary by country; if a product or a dispute depends on the answer, ask a lawyer. When in doubt about a sample, ask its author: most of us are glad to hear the code is being used, and happy to answer.
Sources
- CodeXchange Terms & Conditions (Appeon's Additional Legal Terms, shown when you choose Share Code), with Appeon's Terms of Use
- Sybase CodeXchange Terms of Use, Internet Archive capture of June 2004
- License texts: MIT, Apache 2.0, Boost, LGPL 2.1, GPL 3