[liblouis-liblouisxml] Re: LibLouis DLL Compilation Errors

  • From: Yuemei Sun <yuemei.sun@xxxxxxxxxxxx>
  • To: "liblouis-liblouisxml@xxxxxxxxxxxxx" <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Thu, 23 Apr 2020 01:34:50 +0000

Hi, Phúc

I changed the static declaration of an array to malloc() and free() to compile 
on Windows for liblouis 3.12 using Visutal Studio 2017.

Below is my slight change to the source code:

//=========================10/22/2019====================
//widechar dots[length];  //this causes compiler error on windows
widechar* dots = malloc(length * sizeof(widechar)); //replacng static buffer

if (dots != 0) {//if condition added 10/22/2019
        for (unsigned int k = 0; k < length; k += 1) {
                widechar c = text[k];
                widechar d = _lou_getDotsForChar(c);
                if (d == LOU_DOTS) d = _lou_charToFallbackDots(c);
                dots[k] = d;
        }
}

int iRetUpdatepos = for_updatePositions(dots, 1, length, 0, pos, input, output, 
posMapping,cursorPosition, cursorStatus);

if (dots != 0) //if block added 10/22/2019
        free(dots);

return iRetUpdatepos;
//=======================================================

-----Original Message-----
From: liblouis-liblouisxml-bounce@xxxxxxxxxxxxx 
<liblouis-liblouisxml-bounce@xxxxxxxxxxxxx> On Behalf Of Dang Hoai Phúc
Sent: Wednesday, April 22, 2020 6:13 PM
To: Christian Egli <christian.egli@xxxxxx>
Cc: liblouis-liblouisxml@xxxxxxxxxxxxx; phungtienduong@xxxxxxxxx
Subject: [liblouis-liblouisxml] LibLouis DLL Compilation Errors

Dear All,

I have some errors when compiling LibLouis 3.12 and 3.13 into LibLouis.dll for 
windows. I have followed the instruction in source folder to compile with 
Microsoft community 2017. Can you help examine the errors below and advices, 
please?

I have no problem to compile 3.6 version but with 3.12 and 3.13, it has the 
error:

..\liblouis\lou_translateString.c(2254): error C2057: expected constant 
expression
..\liblouis\lou_translateString.c(2254): error C2466: cannot allocate an array 
of constant size 0
..\liblouis\lou_translateString.c(2254): error C2133: 'dots': unknown size 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.EXE"' 
: return
code '0x2'


Then, I checked with the code and see it stucks at the line: widechar 
dots[length];

I changed to: widechar dots[1024];

Now it can compile successfully and got the Liblouis.dll for all 3 versions, 
3.6, 3.12 and 3.13. However, when calling functions like lou_translateString 
and others, it informs cannot find the function.

I have tried to compile with both Microsoft community 2017 and 2019, both have 
the same errors.

Thanks in advance and look forward to your help.

Phúc

For a description of the software, to download it and links to project pages go 
to http://liblouis.org
Donate: http://liblouis.org/sponsoring
��u��*m���~�^�����޶�h�yhiحjwe�y,��k�7����z�(��m����&��謢��v�zm��剹h�+(�즉좸�

Other related posts: