Connecting Tech Pros Worldwide Help | Site Map

Making a library

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 11th, 2005, 09:15 AM
redneon
Guest
 
Posts: n/a
Default Making a library

Does anyone have any good links to information on how it's possible to
make a library in C++? I can't seem to find anything.


  #2  
Old October 11th, 2005, 09:25 AM
Rolf Magnus
Guest
 
Posts: n/a
Default Re: Making a library

redneon wrote:
[color=blue]
> Does anyone have any good links to information on how it's possible to
> make a library in C++? I can't seem to find anything.[/color]

This is platform/compiler specific. Standard C++ doesn't know anything about
libraries (except the C++ standard library, which is automatically
available), so there is no general C++ way.

  #3  
Old October 11th, 2005, 09:35 AM
redneon
Guest
 
Posts: n/a
Default Re: Making a library

Is it not possible to use external libraries in C++ then like you can
in Java or C#?

I've been away on placement for a year doing C# so my C++ skills have
kind of rusted a bit and the boundaries between the two are blurred in
my brain at the moment =o)

Basically, I'm writing a C++ app for my final year project at
University and what I'm wanting to do is produce a library (or
something similar) which people can #include and then get access to the
member functions etc. that I provide.

In C# it's possible to compile a .dll file and then just include that
to give you access. Is this not possible in C++? Can you offer any
alternatives? I don't really want people cutting and pasting my code
=o)

  #4  
Old October 11th, 2005, 10:05 AM
Karl Heinz Buchegger
Guest
 
Posts: n/a
Default Re: Making a library

redneon wrote:[color=blue]
>
> Is it not possible to use external libraries in C++ then like you can
> in Java or C#?
>
> I've been away on placement for a year doing C# so my C++ skills have
> kind of rusted a bit and the boundaries between the two are blurred in
> my brain at the moment =o)
>
> Basically, I'm writing a C++ app for my final year project at
> University and what I'm wanting to do is produce a library (or
> something similar) which people can #include and then get access to the
> member functions etc. that I provide.
>
> In C# it's possible to compile a .dll file and then just include that
> to give you access. Is this not possible in C++? Can you offer any
> alternatives? I don't really want people cutting and pasting my code
> =o)[/color]

What was uncler with the response you got?

It *is* possible.

Yet, the exact steps needed are completely dependent on which development
system you use. Thus you need to ask in a newsgroup where they discuss
your development environment.


--
Karl Heinz Buchegger
kbuchegg@gascad.at
  #5  
Old October 11th, 2005, 10:05 AM
Jacques Labuschagne
Guest
 
Posts: n/a
Default Re: Making a library

redneon wrote:[color=blue]
> Is it not possible to use external libraries in C++ then like you can
> in Java or C#?
>
> I've been away on placement for a year doing C# so my C++ skills have
> kind of rusted a bit and the boundaries between the two are blurred in
> my brain at the moment =o)
>
> Basically, I'm writing a C++ app for my final year project at
> University and what I'm wanting to do is produce a library (or
> something similar) which people can #include and then get access to the
> member functions etc. that I provide.
>
> In C# it's possible to compile a .dll file and then just include that
> to give you access. Is this not possible in C++? Can you offer any
> alternatives? I don't really want people cutting and pasting my code
> =o)
>[/color]

It is possible, but the mechanics are operating-system dependent. The
C++ standard doesn't say how it's done (or even if it's possible).
Making a DLL on windows is quite different to making a shared library on
Unix, which is again quite different to making one on the Deathstation 9000.
You need to ask this question in a group that deals with your operating
system. (Or google, even.)

Jacques.
  #6  
Old October 11th, 2005, 10:25 AM
redneon
Guest
 
Posts: n/a
Default Re: Making a library

Well at home I use g++ because, primarily, I use Linux. But at
University we have to use Microsoft Visual Studio 2003. This poses
quite a problem for me now. It looks like I'm going to have to use
Visual Studio at home.

Is it actually compiler specific or just OS specific? i.e. Would it be
possible for me to create a .dll using mingw in Windows and then use
that .dll in Visual Studio?

  #7  
Old October 11th, 2005, 04:35 PM
red floyd
Guest
 
Posts: n/a
Default Re: Making a library

redneon wrote:[color=blue]
> Well at home I use g++ because, primarily, I use Linux. But at
> University we have to use Microsoft Visual Studio 2003. This poses
> quite a problem for me now. It looks like I'm going to have to use
> Visual Studio at home.
>
> Is it actually compiler specific or just OS specific? i.e. Would it be
> possible for me to create a .dll using mingw in Windows and then use
> that .dll in Visual Studio?
>[/color]

For g++, try gnu.g++.help
For VC, try microsoft.public.vc.language, or
microsoft.public.vstudio.general

And yes, it is compiler specific, for DLLs. Though you could use a .DEF
file to specify export names. The problem is that each compiler uses a
different name mangling scheme and/or ABI.

For example, I don't believe you can use g++ 2.95 shared libraries with
g++ 3.x code (Disclaimer: this is my experience, I could be wrong).
  #8  
Old October 11th, 2005, 06:05 PM
Javi
Guest
 
Posts: n/a
Default Re: Making a library

I know a HOWTO titled "Program-Library-HOWTO" where you can find
general information about libraries in linux.

I think you can build up your own library creating the object code
from your routines and adding them with the "ar" command creating also
a symbol index (see the ar man page). This way you can create a static
library but I don't know how reliable will it be in other systems or
even if It will work (I think It won't).

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.