Welcome, Guest
Username: Password: Remember me
CodeTyphon MS Windows (Win7, Win8.x, Win10 and Win11) OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15247

  • concrete
  • concrete's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
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:

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

Last edit: by concrete.

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15248

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4508
  • Thank you received: 1100
ADD
program Project1;

{$APPTYPE CONSOLE}
{$MODE Delphi} //<<<======
PilotLogic Architect and Core Programmer

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

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15250

  • concrete
  • concrete's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
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.

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15251

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4508
  • Thank you received: 1100
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

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

Last edit: by Sternas Stefanos.

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15252

  • concrete
  • concrete's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
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.

Indy HTTP Server Upload Handler Will Not Compile 3 years 5 months ago #15254

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4508
  • Thank you received: 1100
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.

  • Page:
  • 1