× CodeTyphon MS Windows (XP, Vista, Win7, Win8.x and Win10) OS Development, discussions and problems

Question Indy HTTP Server Upload Handler Will Not Compile

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 weeks 1 day ago - 2 weeks 1 day ago #15247 by concrete
Hello:

I found an example program online of how to make an upload handler using Indy HTTPServer.

The code works fine when compiled with Delphi, but CT gives me a compiler error:

Compile Project, Target: C:\codetyphon\typhonTemp\project1.exe: Exit code 1, Errors: 2
project1.ppr(96,60) Error: Wrong number of parameters specified for call to "ProcessMimePart"
project1.ppr(16,15) Error: Found declaration: ProcessMimePart(var TIdMessageDecoder;var Boolean;const TIdHTTPResponseInfo);

Can anybody help to figure out why it works with Delphi but not with CodeTyphon?

Host OS: Windows 10 Pro running 32-bit version of CT 7.1 (also tried it with CT 5.9)
Target OS: Windows and Raspbian

---

Attached is the code that I'm using.
Attachments:
Last edit: 2 weeks 1 day ago by concrete.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
2 weeks 1 day ago #15248 by Sternas Stefanos
Replied by Sternas Stefanos on topic Indy HTTP Server Upload Handler Will Not Compile
ADD
program Project1;

{$APPTYPE CONSOLE}
{$MODE Delphi} //<<<======

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 weeks 1 day ago #15250 by concrete
Thank you, Sternas.

This works great for the console application, but I would like to make it into a graphical (LCL) application.

And when I add {$MODE Delphi} into the graphical application, I have other problems:
project1.lpr(4,2) Error: Mode switch "OBJFPC" not allowed here

If I remove this "{$mode objfpc}{$H+}" from the code, then I have many other compiler errors.

Is it not possible to use both directives at the same time?

{$MODE Delphi}
{$mode objfpc}{$H+}

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
2 weeks 1 day ago - 2 weeks 1 day ago #15251 by Sternas Stefanos
Replied by Sternas Stefanos on topic Indy HTTP Server Upload Handler Will Not Compile
No only one directive you can use.

Try this:
Remove all directives and set
to your project Options=>Parsing=>Delphi (-MDelphi}

PilotLogic Architect and Core Programmer
Last edit: 2 weeks 1 day ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • concrete
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 weeks 1 day ago #15252 by concrete
It works fine now with {$MODE Delphi}.

The other errors I was able to fix by changing some of my code.

I was doing things like:
var ValueAmount: string;
case ValueAmount of
  '01':  ValueDescription := 'Value 01';
  '02':  ValueDescription := 'Value 02';
end;


This works great when using {$mode objfpc}, but for Delphi mode, I had to get rid of the case statement and replace it with a bunch of
if...else
statements.

I wish Delphi would finally introduce the ability to use string types in a case statement. It would make things so much easier.

Thank you for helping, and thank you for CodeTyphon. I've been using it since 2015 to develop production code that runs 24/7 on RPi for several different industrial projects.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
2 weeks 23 hours ago #15254 by Sternas Stefanos
Replied by Sternas Stefanos on topic Indy HTTP Server Upload Handler Will Not Compile
Thanks Sir
More advance things for Pi will be come... :)

Have fun...

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.