Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Can I license different parts of my code (different classes) under different licenses?

E.g. I have downloaded and modified a class which licensed under the BSD 3 point.

Can I then say, file AObject.class is BSD, and BObject.class is LGPL (or MIT, or MPL, or PD, etc etc)

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

You can license code you write with whatever combination of licenses you please. However this may not make sense.

For example if you license one file with the GPL and another with a closed source license no one is going to be able to use your code as a whole. People will be able to take your GPL code and use it separately in GPL solutions but since the GPL conflicts with closed source licenses they could not use both.

you can also release code under two or more licenses. So you may release code file.cpp under both GPL and BSD and allow people to choose which license applies to them. Or you could charge people a fee to have the code with one license and provide the code under a GPL license for free.

Remember that your license choice will affect your ability to take code "back into" your project. So if file1 is Closed Source and file 2 is GPL in the same project, you will not be able to put other peoples GPL code into your GPL file as this would be a violation of the GPL license.

share|improve this answer
add comment

I believe this really depends on which license is being applied where.

My understanding is you cannot use license X is it steps on license Y toes.

However, I did find some good information here: Multi-licensing Wikipedia

share|improve this answer
add comment

Technically a piece of source is a document which can be copyrighted. So technically you can do so, but you'd have to be able to use both licenses at the same time when using your code in the end product. So practically the separation can best be made at a compilation unit such as a dll, which contains (or should contain) a functional and related set of classes/code.

share|improve this answer
add comment

The issue of license compatibility aside, you can certainly license different portions of your code differently and this is quite common for commercial software that has Open Source integrated into it. One project I was on included the mingw compiler as part of the installation as well as ACE, OpenSSL, and several other bits from around the net. It took our lawyers weeks to be certain we'd dotted our i's and crossed our t's with our legal obligations, but in the end we shipped and even made the principals of those other projects aware of our use of their software.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.