Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create a library that can be called by Visual C++ 2009 Express Edition

0 views
Skip to first unread message

Johnson

unread,
Oct 2, 2009, 7:29:11 PM10/2/09
to
I have created a C++ application with Visual C++ 2008 Express Edition,
and now I want to hide some codes into a library, then call this library
within the C++ application.

I think I can only create Class Library with Visual C++ 2008 Express
Edition, which will be managed codes. If I do so, I will encounter the
problem as calling managed C++ codes from unmanaged C++ codes, which is
far from easy. Any suggestion please?

For example, can I develop the library with other free tools/IDEs such
as Eclipse and gcc, or Borland C++? This way I will have a unmanaged C++
library. please help.

Thank you in advance!

Johnson

Ulrich Eckhardt

unread,
Oct 3, 2009, 3:41:00 AM10/3/09
to
Johnson wrote:
> I have created a C++ application with Visual C++ 2008 Express Edition,
> and now I want to hide some codes into a library, then call this library
> within the C++ application.

This is outside the scope of C++ but falls in the scope of the particular
toolset you are using. I'd suggest asking in one of the microsoft.*
newsgroups. If your newsserver doesn't serve those, I think that MS provide
access to that hierarchy.

> For example, can I develop the library with other free tools/IDEs such
> as Eclipse and gcc, or Borland C++?

Generally, you can not mix code compiled with different C++ compilers.

Uli

Stuart Golodetz

unread,
Oct 3, 2009, 5:43:39 AM10/3/09
to

This isn't on-topic here (please see the FAQ at
http://www.faqs.org/faqs/C-faq/learn/, particularly FAQ 5) - you want a
Microsoft newsgroup under the microsoft.public.vc.* hierarchy (e.g.
microsoft.public.vc.ide_general is a good bet).

That being said, you can create an unmanaged static library from the
Visual C++ -> Win32 -> Win32 Console Application template: click Next in
the wizard and select "Static library" as the application type (you'll
probably also want to select "Empty project", for what it's worth).

Cheers,
Stu

Christian Freund

unread,
Oct 3, 2009, 6:37:48 AM10/3/09
to
It is possible to mix shared-object-code in a library for dynamic linking
(.so .a .dll etc...) on all platforms I was in contact with, no matter with
what compiler these libraries for dynamic linking were made.

"Ulrich Eckhardt" <doom...@knuut.de> schrieb im Newsbeitrag
news:7iodgdF...@mid.uni-berlin.de...

Ulrich Eckhardt

unread,
Oct 3, 2009, 9:18:12 AM10/3/09
to
Christian Freund wrote:
> It is possible to mix shared-object-code in a library for dynamic linking
> (.so .a .dll etc...) on all platforms I was in contact with, no matter
> with what compiler these libraries for dynamic linking were made.

You have to make a distinction between C and C++ here. In C++, you have to
consider two main things in which compilers differ:
- name mangling
- exception handling and other parts of the binary interface

Name mangling is explicitly aimed to make use of incompatible libraries fail
at link time. Other than that, compilers also come with different
implementations of the C++ standard library that are binary incompatible.

C libraries are generally compatible.

Uli

Johnson

unread,
Oct 5, 2009, 11:44:53 AM10/5/09
to
Thank you all for helping. The best way to learn it is to test it. I
will test the methods you proposed in my project. I will try the Win32
Console with unmanaged codes first.

Johnson

0 new messages