[fpc-pascal] error while compiling

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Feb 6 14:29:43 CET 2010

On 06 Feb 2010, at 09:21, dayat wrote:

> I have a function ftest located in library program (dll).
> function ftest(Param: PWideChar): PWideChar; stdcall; export;
> And will call them with a program with use:
> function ftest(Param: PWideChar): PWideChar; stdcall; external 'test.dll';
> while compiling to exe, I got error like this:
> C:\fpc\test>fpc testcall.pas
> Free Pascal Compiler version 2.4.0 [2009/12/18] for i386
> Copyright (c) 1993-2009 by Florian Klaempfl
> Target OS: Win32 for i386
> Compiling testcall.pas
> testcall.pas(11,26) Fatal: Unknown compilerproc "fpc_read_text_widechar".
> Check
> if you use the correct run time library.
> Fatal: Compilation aborted
> Error: C:\usr\local\fpc\2.4.0\bin\i386-win32\ppc386.exe returned an error
> exitco
> de (normal if you did not specify a source file to be compiled)
> What the wrong, how to solving the problem.

It is unrelated to those funcion definitions. Apparently, we forgot to include a read() helper for reading a single widechar in the RTL. I guess you are doing a read(param^) inside ftest, which requires this helper.

You can work around it by reading an entire widestring at once, if that is possible in your program.


More information about the fpc-pascal mailing list