Recent

Author Topic: Porting FANN  (Read 31599 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Porting FANN
« on: February 17, 2010, 04:38:42 am »
Fast Artificial Neural Network Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks. Cross-platform execution in both fixed and floating point are supported. It includes a framework for easy handling of training data sets. It is easy to use, versatile, well documented, and fast. PHP, C++, .NET, Ada, Python, Delphi, Octave, Ruby, Prolog Pure Data and Mathematica bindings are available.

I was trying to convert fann.pas from Delphi code, but the converter stopped in this code:

Code: [Select]
function fann_create_standard; external DLL_FILE;
with the message:

Error:  : expected, but ; found

Any suggestions?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8244
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting FANN
« Reply #1 on: February 17, 2010, 05:59:55 am »
Code: [Select]
Any suggestions?The error message is clear: what is the return type of the function?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8597
  • FPC developer.
Re: Porting FANN
« Reply #2 on: February 17, 2010, 09:05:36 am »
Are you in $mode delphi?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Porting FANN
« Reply #3 on: February 17, 2010, 04:42:57 pm »
Yes, I am in $mode Delphi.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8244
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting FANN
« Reply #4 on: February 18, 2010, 05:03:03 am »
That's weird. Are you getting Delphi mode from -Sd or {$mode delphi} around the top of the code? Source directives have higher precedence than compiler options.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1031
    • Burdjia
Re: Porting FANN
« Reply #5 on: February 18, 2010, 01:57:59 pm »
I was trying to convert fann.pas from Delphi code, but the converter stopped in this code:

Code: [Select]
function fann_create_standard; external DLL_FILE;
with the message:

Error:  : expected, but ; found

Any suggestions?

As said above, your function declaration lacks return type.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Legolas

  • Full Member
  • ***
  • Posts: 117
    • http://itaprogaming.free.fr
Re: Porting FANN
« Reply #6 on: February 18, 2010, 03:18:54 pm »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Porting FANN
« Reply #7 on: March 15, 2010, 02:38:27 pm »
I am trying to compile XorConsole example project to Delphi in Lazarus and I have an error on this line:

writeln(Format('%f Xor %f = %f',[inputs[0],inputs[1],Calc_Out[0]]));

with the message:

XorConsole.lpr(40,83) Error: Wrong type "Fann_Type_Array" in array constructor

Any idea?


JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3807
  • I like bugs.
Re: Porting FANN
« Reply #8 on: March 17, 2010, 08:05:30 am »
I was trying to convert fann.pas from Delphi code, but the converter stopped in this code:

Code: [Select]
function fann_create_standard; external DLL_FILE;
with the message:

Error:  : expected, but ; found

Any suggestions?

Did the error came from compiler or converter? You could try the converter in latest SVN Lazarus version. I have improved the source conversion. Form files with missing properties is still under construction.
However, the converter doesn't change an external function declaration. Non-portable (Windows only) code usually needs lots of manual work after converter.

Juha
Mostly Lazarus trunk on Manjaro Linux.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Porting FANN - Another problem
« Reply #9 on: March 19, 2010, 12:51:01 am »
Another problem: I have this program:

Code: [Select]
program ProjectXor;

{$mode delphi}

uses
  Forms,
  XorSample in 'XorSample.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.               


and the compiler message is "ProjectXor.lpr(6,3) Fatal: Can't find unit Forms used by ProjectXor"

Thanks.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3807
  • I like bugs.
Re: Porting FANN
« Reply #10 on: March 19, 2010, 01:38:30 am »
Are you using Lazarus and have the Lazarus directory in environment options set correctly? Forms unit is part of LCL.
For conversion, please try the latest Lazarus SVN version.

Juha
Mostly Lazarus trunk on Manjaro Linux.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Porting FANN
« Reply #11 on: March 30, 2010, 06:11:36 am »
It occurs only in this project.
« Last Edit: March 30, 2010, 06:24:03 am by typo »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8244
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting FANN
« Reply #12 on: March 30, 2010, 10:25:10 am »
Quote
It occurs only in this project.
Check Project Inspector. Does it have LCL as dependency?
« Last Edit: March 30, 2010, 10:29:32 am by Leledumbo »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Porting FANN
« Reply #13 on: March 30, 2010, 11:55:21 am »
No. What should I do?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8244
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting FANN
« Reply #14 on: March 30, 2010, 12:38:46 pm »
Quote
No. What should I do?
Add it. Use Add->New Requirement, then choose LCL.

 

TinyPortal © 2005-2018