I recently installed Gnu Pascal (DJGPP-MSDOS) and was appalled at the fragility of the compiler.
I had enormous problems with procedural-parameters, file types and proper accessing of types defined in Units.
Eventually, I downloaded the latest alpha (gpc-980511.i386-pc-msdos-djgpp.zip) and am delighted that this version will at least compile my program.
If someone could tell me where to get the crtf.o file, the linker keeps asking for, I might even be able to see if the code actually runs.
The compiler still apparently has problems with type definitions in units.
I have a program that uses two units:
1) pktdefs - type definitions 2) frames - unit to handle access to large data files
The frames unit declares an object that has a method:
function GetNextDataPkt(VAR pkt : PacketPtr) : BOOLEAN;
The type PacketPtr is declared in pktdefs and my main program and frames USE pktdefs.
When my main program tries to call GetNextDataPkt, I get a compiler error:
Error: type mismatch in argument 2 of `Tframes_Getnextdatapkt'
The code in question is:
while MyFrames.GetNextDataPkt(pp) do
If I move the PacketPtr declaration into frames.pas, the compiler error disappears.
I don't know how there can be an error in argument 2 of a function with only one parameter. Perhaps the return value is argument 1.
However, the compiler apparently thinks that the type "PacketPtr" used in frames is different from "PacketPtr" used in the main program, even though both "import" the declaration from the same unit.
Russell Thamm
According to Thamm, Russell:
The compiler still apparently has problems with type definitions in units. [...] Error: type mismatch in argument 2 of `Tframes_Getnextdatapkt'
That looks known for me ... :-(
You have encountered one of the most unpleasant problems in GPC.
I don't know how there can be an error in argument 2 of a function with only one parameter. Perhaps the return value is argument 1.
Argument 1 is the implicit self parameter. But you are right: We should clarify that error message.
However, the compiler apparently thinks that the type "PacketPtr" used in frames is different from "PacketPtr" used in the main program, even though both "import" the declaration from the same unit.
Exactly. :-(
I am currently working on this bug. There is some hope that it will be fixed in the next Alpha. (More precise: This bug is one of the reasons why the next Alpha has not yet been released and declared at least "Beta".)
Greetings,
Peter
Thamm, Russell a écrit:
I recently installed Gnu Pascal (DJGPP-MSDOS) Eventually, I downloaded the latest alpha (gpc-980511.i386-pc-msdos-djgpp.zip) If someone could tell me where to get the crtf.o file, the linker keeps asking for,
it is in %DJGPP%\lib\djgpp\gcc-lib\2.81
There have been a major reorganisation of the djgpp directory structure when going from 2.7.2.x to 2.8.x If you have kept the old installation with the new gpc, you will have such kind of troubles. Notably DJGPP.ENV has been changed to look to the new directory structure and files like djgpp.djl and specs. have been changed and moved from %DJGPP%\lib to the abovementioned directory. If both old and new versions of these files are there, the wrong one is selected !