4

Simply, If I use reflection to add methods or functionality to a class defined in a LGPL'd library I'm linking to, does that count as a modification to the existing library and would my reflective code have to be released under the LGPL?

Magnus
  • 257
  • 1
  • 6

2 Answers2

4

http://www.gnu.org/licenses/lgpl-3.0.en.html

I'd say that reflecting into the LGPL lib is a 'combined work' and so is subject to the limitations described in the licence:

A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

So, given these definitions (where your reflecting into the library is equivalent to linking with it and the code that does the reflection is the minimal corresponding source) you have to follow this section:

  1. Combined Works.

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: ...

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.

1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.

so I'd say (Note: IANAL) you'd have to release the reflecting code part of your app under the LGPL too, though the section of your app that uses that code can still be proprietary.

9000
  • 24,162
  • 4
  • 51
  • 79
gbjbaanb
  • 48,354
  • 6
  • 102
  • 172
  • 1
    Thanks gbjbaanb, this answer makes an excellent companion to [my answer](http://programmers.stackexchange.com/a/136773/22493) to [Does the LGPL allow me to do this?](http://programmers.stackexchange.com/q/136702/22493) which only speaks about LGPL 2.1, so I've added a link to your answer from mine. – Mark Booth Mar 01 '12 at 12:46
2

I'd say this is hardly different from creating a new class by extending a base class in an LGPL library. You're just doing the introspection at run time instead of compile time. Therefore, it's a derivative work, which doesn't require you to disclose your source code.

TMN
  • 11,313
  • 1
  • 21
  • 31