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.
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.
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.
> 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
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).
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.
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.
Ulrich Eckhardt wrote: > 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
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.