Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-02

error while compiling

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dayat

Dear,

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.
thanks
dayat

Reply by email

Jonas Maebe
to dayat
dayat wrote 24 lines
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.

Jonas

Reply by email