gotomypc / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

getLeptonlibVersion() is incorrect when using the VS2008 static libraries #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call getLeptonlibVersion() when linked to either leptonlib-static-mtdll.lib 
or leptonlib-static-mtdll-debug.lib.

What is the expected output? What do you see instead?
I expect to see:
leptonlib-1.67 (Nov 13 2010, 00:28:54) [MSC v.1500 LIB Debug 32 bit]
Instead I see:
leptonlib-1.67 (Nov 13 2010, 00:28:54) [MSC v.1500 DLL Debug 32 bit]

What version of the product are you using? On what operating system?
leptonlib-1.67
Microsoft Visual Studio 2008
Windows XP Pro SP3.

Please provide any additional information below.
The problem is that getLeptonlibVersion() in utils.c does the following to 
determine if the DLL version is being built:

  #ifdef _DLL
    char dllStr[] = "DLL";
  #else
    char dllStr[] = "LIB";
  #endif

Unfortunately, as "Predefined Macros" 
http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.90%29.aspx clearly 
states:

   _DLL  Defined when /MD or /MDd (Multithreaded DLL) is specified.

Since we always build with /MD or /MDd, "_DLL" is also always defined.

When I first made the DLL build configurations, I copied the LIB configuration 
and simply changed the "_LIB" define to "_DLL". What I should have done is 
define "_USRDLL" which is what the New Projects Wizard does.

So getLeptonlibVersion() should be changed to:

  #ifdef _USRDLL
    char dllStr[] = "DLL";
  #else
    char dllStr[] = "LIB";
  #endif

and I will change the VS2008 project files to correctly define "_USRDLL" when 
building DLL configurations.

Original issue reported on code.google.com by tomp2...@gmail.com on 14 Nov 2010 at 7:31

GoogleCodeExporter commented 9 years ago
Thanks for posting and providing the detailed explanation as well as the fix.
It will go out with 1.68

Original comment by dan.bloo...@gmail.com on 20 Nov 2010 at 6:04

GoogleCodeExporter commented 9 years ago
fixed in 1.68

Original comment by dan.bloo...@gmail.com on 16 Mar 2011 at 12:07