Create static library from application - Linux
This is a discussion on Create static library from application - Linux ; Hi,
How do you convert an open source application into a static library such
that its functions may be used as API (for other application development)?
So far, I have downloaded the application and successfully performed
configure, automake and make. ...
-
Create static library from application
Hi,
How do you convert an open source application into a static library such
that its functions may be used as API (for other application development)?
So far, I have downloaded the application and successfully performed
configure, automake and make. However, what should the next step be?
For now, the Makefile.am, Makefile.in, Makefile, source code and *.o
files are all ready but I am stuck here..
From googling, 'ar rcs' step may be used but I am not so sure of the
dependencies between the object files...
Best rgds,
Paul
-
Re: Create static library from application
Paul wrote:
> Hi,
>
> How do you convert an open source application into a static
> library such that its functions may be used as API (for other
> application development)?
Functionally an application is a library, which provides an entry
function, that gets executed, once the application has been
loaded. In this entry function the application initializes
itself and then does, whatever it has been written to do.
If you'd just load an application binary like a library you
couldn't use it. Every library needs to be initialized somehow.
In the case of an application this would mean, that you execute
it's entry function, BUT then that application would run, not
your own.
So what you really have to do, is to "disassemble" the program
(not disassemble the binary), which means: Identify the parts a
program consists of, extract what you need and add code, that
makes those parts work independent of the rest of the
application. However: Any bigger application actually is written
in the form of several libraries, which are ultimately tied
together by sourrounding application. E.g. the KDE desktop
provides a lot of components, called KParts, one of them e.g. is
the Kate-part, which provides a very versatile text editor
component (which is some sort of library). Now applications use
this component, to provide a text editor and one of these
applications is called: Kate. Here you have it: The guts of an
application have been written as independent
components/libraries/parts/whatever you like to call it, and
those are then glued into a main application the user starts.
The odds are high, that the functionality you want to use in your
own program was implemented in the foreign application in form
of a separate libaray, which you can use in your program out of
the box.
Happy coding, and respect the licence of the program you use code
of, please.
Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867
-
Re: Create static library from application
On Sun, 02 Dec 2007 00:02:38 +0100, Wolfgang Draxinger wrote:
> Paul wrote:
>
>> Hi,
>>
>> How do you convert an open source application into a static library
>> such that its functions may be used as API (for other application
>> development)?
>
> Functionally an application is a library, which provides an entry
> function, that gets executed, once the application has been loaded. In
> this entry function the application initializes itself and then does,
> whatever it has been written to do.
>
> If you'd just load an application binary like a library you couldn't use
> it. Every library needs to be initialized somehow. In the case of an
> application this would mean, that you execute it's entry function, BUT
> then that application would run, not your own.
>
> So what you really have to do, is to "disassemble" the program (not
> disassemble the binary), which means: Identify the parts a program
> consists of, extract what you need and add code, that makes those parts
> work independent of the rest of the application. However: Any bigger
> application actually is written in the form of several libraries, which
> are ultimately tied together by sourrounding application. E.g. the KDE
> desktop provides a lot of components, called KParts, one of them e.g. is
> the Kate-part, which provides a very versatile text editor component
> (which is some sort of library). Now applications use this component, to
> provide a text editor and one of these applications is called: Kate.
> Here you have it: The guts of an application have been written as
> independent components/libraries/parts/whatever you like to call it, and
> those are then glued into a main application the user starts.
>
> The odds are high, that the functionality you want to use in your own
> program was implemented in the foreign application in form of a separate
> libaray, which you can use in your program out of the box.
>
> Happy coding, and respect the licence of the program you use code of,
> please.
>
> Wolfgang Draxinger
got it! tried and making progress!!
thanks