[liblouis-liblouisxml] Re: LibLouis DLL Compilation Errors

  • From: Dang Hoai Phúc <danghoaiphuc@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx, James Bowden <James.Bowden@xxxxxxxxxxx>
  • Date: Fri, 24 Apr 2020 20:33:34 +0700

Thanks Christian, Yuemei and James for your points. Finally, I can compile and find out that the precompiled version of Liblouis available on Github has about 600Kb with more than hundred of functions while my compiled dll is just more than 100Kb with about 30 functions. Before, I used the Lou_translateString but it doesn't include in my compiled version. It has a different one with underscore sign before. I am not sure what are the differences between two functions but I have tried and got the same result.

Your clarifications is highly appreciated and thankful.

Best,

Phúc

Another point that when I compiled with UCS2 or UCS4, I see no differences in terms of Braille translation result.

On 4/24/2020 4:32 PM, James Bowden wrote:

Hi,

I have never personally compiled Liblouis, but a typical problem if your 
program cannot link is that there is a mismatch in the linker function 
definitions.

One way was to provide a DEF file to the linker.
I don't know if this is the problem here, but it might be.
There was also a keyword something like _dllexport (it is a while since I made 
a DLL using Visual C++).

In your own project, make sure that you have included the liblouis.lib file in 
the link imputs.

Sorry this is vague, but I hope it might give some pointers.

With best regards,

James.






-----Original Message-----
From: liblouis-liblouisxml-bounce@xxxxxxxxxxxxx 
[mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx] On Behalf Of Dang Hoai Phúc
Sent: 23 April 2020 06:23
To: liblouis-liblouisxml@xxxxxxxxxxxxx; Yuemei Sun
Cc: phungtienduong@xxxxxxxxx
Subject: [liblouis-liblouisxml] Re: LibLouis DLL Compilation Errors

Dear Yuemei,

I applied your code and it compiles successfully but it's still with
error, no functions found from the dll when calling.

Phúc

On 4/23/2020 8:34 AM, Yuemei Sun wrote:
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 ;<http://liblouis.org>
Donate: http://liblouis.org/sponsoring ;<http://liblouis.org/sponsoring>
��u��*m���~�^�����޶�h�yhiحjwe�y,��k�7����z�(��m����&�謢��v�zm��剹h�+(�즉좸�g===

--
Dang Hoai Phúc/Executive Director
Sao Mai Center for the Blind
Website: https://www.saomaicenter.org

For a description of the software, to download it and links to
project pages go to http://liblouis.org
Donate: http://liblouis.org/sponsoring

Other related posts: