[fpc-pascal] error while compiling

2010-02-06 Thread 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\testfpc 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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] error while compiling

2010-02-06 Thread Jonas Maebe

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\testfpc 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___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal