- Posts: 11
- Thank you received: 0
×
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
- New Member
-
Less
More
2 months 1 week ago - 2 months 1 week ago #15247
by concrete
Indy HTTP Server Upload Handler Will Not Compile was created 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:
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.
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.
Last edit: 2 months 1 week ago by concrete.
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 months 1 week ago #15248
by Sternas Stefanos
PilotLogic Architect and Core Programmer
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
- New Member
-
Less
More
- Posts: 11
- Thank you received: 0
2 months 1 week ago #15250
by concrete
Replied by concrete on topic Indy HTTP Server Upload Handler Will Not Compile
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:
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+}
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
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 months 1 week ago - 2 months 1 week ago #15251
by Sternas Stefanos
PilotLogic Architect and Core Programmer
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}
Try this:
Remove all directives and set
to your project Options=>Parsing=>Delphi (-MDelphi}
PilotLogic Architect and Core Programmer
Last edit: 2 months 1 week ago by Sternas Stefanos.
Please Log in or Create an account to join the conversation.
- concrete
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 11
- Thank you received: 0
2 months 1 week ago #15252
by concrete
Replied by concrete on topic Indy HTTP Server Upload Handler Will Not Compile
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:
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 ofstatements.
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.
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
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
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 months 1 week ago #15254
by Sternas Stefanos
PilotLogic Architect and Core Programmer
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...
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.