ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  C++ Win32 version as a static library?
Posted by Vlk on Dec-06-2006 23:58
Hi,

the  C++ Win32 version of ChartDirector comes in a form of a DLL (chartdir41.dll). Would it be possible to get a static library instead? The reason I'm asking - we'd only like to use a very small subset of ChartDirector's functionality, and it seems like an overkill to distribute a 1.8MB DLL together with our app even though most of its contents will never be called...

Thanks!
Vlk

  Re: C++ Win32 version as a static library?
Posted by Peter Kwan on Dec-07-2006 02:18
Hi Vlk,

Unluckily, it is not practical to release a static library for Windows programs.

For a static library to work, it must match with your linkage type, build type, compiler brand, compiler version, project configuration, etc..

For example, a static library designed for Release mode cannot be linked to a program in Debug mode (because they use different C runtime). That means if we provide a Release mode library, there is no easy way you can debug your program.

Also, a library linking with C runtime in DLL cannot be used if your program linked to the C runtime statically. The same applies for the configuration of the MFC runtime. Also, there are two variants of MFC (Unicode and MBCS), which must match as well. In older development tools (Visual Studio 6), there are also different C runtime for multi-threading and single-threading, and this has to match. The compiler brand and versions also need to match. For example, static C++ code compiled with VS 6 cannot be used with VS 7 or VS 2003/2005 (due to different C++ runtime).

In summary, there is no practical way to release static libraries, because there are too many combinations of compiler versions, compiler brands, debug/release mode, single/multi-thread mode, C runtime linkage method, MFC variants, etc..

On the other hand, a DLL solves all these problems. The ChartDirector DLL can be used with any compiler brand and versions in any project configuration without any issue.

So I am worry you would need to use the DLL instead of using static libraries.

Regards
Peter Kwan

  Re: C++ Win32 version as a static library?
Posted by Vlk on Dec-07-2006 02:42
Peter,

thanks a lot for your reply. I got your point. I was more interested in finding out if there's A way to do it (for example, we pay you some money and you get us the static version :-))

I see that you're using MSVC 6.0 to compile the code. This may mean that you don't even own the later versions of the compiler, right? (right now, we're using MSVC 2003, transitioning to 2005 soon...)


Thanks
Vlk

  Re: C++ Win32 version as a static library?
Posted by Peter Kwan on Dec-07-2006 02:54
Hi Vlk,

We have all known versions of Microsoft compilers since VC 6 (VC 7, VC 2003, VC 2005) and ChartDirector is tested against all of them.

The reason we use VC 6 is because it works with all later compilers, and it results in the smallest and easiest to distirbute DLL. If you use C++ with VC 7, then we also needs to redistribute the Microsoft C++ runtime with your software. (Windows OS does not come with the new C++ runtime.)

However, if we use VC 6, then we do not need to redistribute the Microsoft C++ runtime DLL, because there is no such thing in VC 6, and all the necessary C runtime required are standard in Windows OS and so we do not need to redistribute them.

Regards
Peter Kwan

  Re: C++ Win32 version as a static library?
Posted by Emad Nebih on Aug-27-2008 03:10
In my case, I really need to create a static library of Chart Director. Assuming that I have good reasons for it, is it possible to re-compile the code for a static library? What's the way to do it please?

  Re: C++ Win32 version as a static library?
Posted by Peter Kwan on Aug-27-2008 17:25
Hi Emad,

As mentioned in this thread, for a static library to work, it must match with your linkage type, build type, compiler brand, compiler version, project configuration, code generation options, etc..

Furthermore, a static library designed for Release mode cannot be linked to a program in Debug mode (because they use different C runtime). That means if we provide a Release mode library, there is no easy way you can debug your program.

So if we compile a static library for you, you need to inform me your exact compiler brand, compiler version and project configuration, and hope that we have the same compiler as you.

If you change your compiler (say upgrade to a new version of Visual Studio), or change your project type, the static library will not work any more. Also, if we upgrade ChartDirector or release patches for bug fixes, it is not practical for us to re-complie the code for all specific customers.

So I am worry it is not practical for us to release static libraries.

Regards
Peter Kwan

  Re: C++ Win32 version as a static library?
Posted by KGB on Feb-26-2012 16:51
Still no static library?

  Re: C++ Win32 version as a static library?
Posted by Peter Kwan on Feb-28-2012 00:25
Hi KGB,

For the same reasons mentioned previous in this thread, it is unlikely we will release a static library edition of ChartDirector for C++.

If we were to release a static library edition, we may need to release a few dozens or hundreds of static library versions, to handle the different combinations of compiler brand, versions and compliation flags, and the user would need to know which one to use for his combination of brand, versions and compliation flags. It would be impractical for us to manage.

Regards
Peter Kwan