Board index » delphi » Linking C in Turbo Pascal or Borland Pascal?
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Patrick D. Rockwel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Linking C in Turbo Pascal or Borland Pascal?
I know that the TSFAQPAS files by Timo Salmi touch on this question, but
they answer by refering to books that are out of print, so here is my question. 1. I know that you can write assembly language into a unit, but can you 2. If so, can you do this for both Borland AND Turbo Pascal? 3. Is C faster than Turbo or Borland Pascal? Thanks in advance. -- |
Robert AH Prin
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?In article <3A107A89.1EBDD...@thegrid.net>, Quoteprockw...@thegrid.net wrote: Quote> 2. If so, can you do this for both Borland AND Turbo Pascal? other. Quote> 3. Is C faster than Turbo or Borland Pascal? than a product that is almost a decade old and still generates 16-bit code. Robert Sent via Deja.com http://www.deja.com/ |
Frank Peel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?"Patrick D. Rockwell" <prockw...@thegrid.net> wrote in message Quote> I know that the TSFAQPAS files by Timo Salmi touch on this question, compiler in the Pascal compiler though so- no. I suppose you could do some wierd mucking around with conditional compilation stuff, put the C code in a comment and use the C preprocessor to have the C compiler avoid the Pascal, so that it's physically possible for one file to have a Pascal unit and some C source at the same time, and be compiled by separate compilers but there wouldn't be much point IMHO. FP |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?JRS: In article <3A107A89.1EBDD...@thegrid.net> of Mon, 13 Nov 2000 15:34:33 seen in news:comp.lang.pascal.borland, Patrick D. Rockwell Quote<prockw...@thegrid.net> wrote: Care will be needed with anything that might invoke a C library call. AIUI, TP & BP are reasonably fast, and so is C. The quality of the -- |
Rudolf Polze
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?"Robert AH Prins" <pr...@bigfoot.com> schrieb im Newsbeitrag news:8ur8r2$p58$1@nnrp1.deja.com... Quote> In article <3A107A89.1EBDD...@thegrid.net>, [sNIP] Quote> > 3. Is C faster than Turbo or Borland Pascal? applications statically with the well-known linkers, and you will have to use thunking when using DLLs; you can, however, use 32-Bit registers in asm code even in TP. -- Rätsel: |
Antoine Lec
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?QuotePatrick D. Rockwell wrote: to create .obj, and then you can link the .obj the same way as independant assembler sources. Just take care of the '_' prepended to C names... HOWEVER, the C runtime library (malloc, printf) is not usable Quote> 2. If so, can you do this for both Borland AND Turbo Pascal? Quote> 3. Is C faster than Turbo or Borland Pascal? its name because it compiles much faster. As a result, you usualy develop faster, BTW. Or you can research better algorithms for the critical parts (this is where the profiler comes handy). As for the produced code: intrinsically, C and Pascal constructs Antoine |
Vortex Vande
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?Quote"Antoine Leca" <Antoine.L...@renault.fr> wrote in message Quote> Patrick D. Rockwell wrote: compiled.. (from memory by useing the {$o filename} or {$i filename} directive? mind you you "could" design a prepreocessor for c or pascal that would only compile one language or the other. but that's to much hassle.. just grab the code that you want .. make it into a procedure and compile it. tp7 etc can do "c style" procedure calling with a command.. look at the tp7 help files if you have them.. other wise grab a copy of it.. it should be abandon ware in the us.. as it's old enuff now. (2 years?) so all talk of pirateing is null and void if your in the us. sorry to recover all that :) Quote> HOWEVER, the C runtime library (malloc, printf) is not usable Quote> And providing the services of the C runtime library is not speed+size+code optimization but now adays the c boys have tweaked,broken,fixed,twaked again etc and got better if not the same as tp. I remember seeing time/size comparasans between the diffrent compilers and The underlying design of pascal is that it's a ONE pass compiler i.e you The only problem with tp7 is the lack of 386+ compileing options.. it stopps |
Antoine Lec
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?QuoteVortex Vandel wrote: .obj (like Delphi 2+ does). Do you imagine that the resulting .obj will mix well with the C runtime library? It won't. Quote> > > 3. Is C faster than Turbo or Borland Pascal? Regarding size, mileage may vary, but with big projects C binaries tended to end smaller (with small programs, the bigger size of the C library did not compensate for the optimisation). Quote> but now adays the c boys have tweaked,broken,fixed,twaked again etc speed of compilation. In fact, my everyday experience is plain reverse. Unfortunately :-( Quote> I remember seeing time/size comparasans between the diffrent or the test programs were restricted to Hello, World. Quote> The underlying design of pascal is that it's a ONE pass compiler i.e you second is linking). C compilers OTOH are 1.5+1 pass: when compiling, it needs a supplementary partial pass to re-read (and re-tokenise) the ".h" of the included modules; linking is comparable to TP in spirit. Previous C compilers did have (gcc still has, for some months) a supplementary pass at the very beginning, named the pre-processor. A bigger point is the format of the intermediary files: C traditionnaly Quote> The only problem with tp7 is the lack of 386+ compileing options.. it it, but it is not branded by Borland. Its name are FreePascal, TMT, and Virtual Pascal (in alphabetic order! I hope I did not miss anybody important, sorry if I don't). Antoine |
gdem..
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?Antoine Leca: Quote> AFAIK, TP4+ is a 2-pass "compiler" (one pass is compiling, the debugging, drinking a coffee). ;-) Seriously, I would say there is *one* pass (producing a .TPU or, Quote> The real optimisation here is to go 32-bit. As such, TP7 do have ______________________________________________________ Gautier -- http://members.nbci.com/gdemont/gsoft.htm Sent via Deja.com http://www.deja.com/ |
Marco van de Voo
![]() Delphi Developer |
Mon, 12 May 2003 09:16:06 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?QuoteIn article <3A1BFFC3.BCB4F...@renault.fr>, Antoine Leca wrote: the era do better? Probably TopSpeed, but the M2 version I used wasn't as slow as a C compiler, Quote>My impression is not that C compilers did improve in the area of FPC is also slower than BP :-) But I've seen over 100.000 lines in 10 seconds on a K6-2 500 (recompiling itself with optimisations, but with most sources cached in my 64 MB probably, so this is an extreme value) Quote>> The underlying design of pascal is that it's a ONE pass compiler i.e you 1 scanning (preprocessing, external in C mostly) On the other hand TP does its own (though more limited preprocessing), which Quote>Previous C compilers did have (gcc still has, for some months) a - reparsing headers for *each* file. (Though this could be cached by saving When adding the binary writer to FPC (thus making external assembling Quote>A bigger point is the format of the intermediary files: C traditionnaly this argument is not valid. Quote>OTOH, TP use a private format that same processor are also incompatible. Quote>> The only problem with tp7 is the lack of 386+ compileing options.. it |
m..
![]() Delphi Developer |
Mon, 12 May 2003 12:33:28 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?QuoteAntoine Leca <Antoine.L...@renault.fr> wrote: Quote> C compilers OTOH are 1.5+1 pass: when compiling, it but in any case, there's no such thing as a 0.5 pass. Quote> Previous C compilers did have (gcc still has, for some months) a |
Antoine Lec
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?Quote> Antoine Leca <Antoine.L...@renault.fr> wrote: thoughout the object intermediary code to collect the links to establish (I neglect the recursive part of the linked in libraries here). Both C and TP4+ runs this job as a separate task done *after* the main compilation to binary object code. Hence my formula. I was answering a point that C compilers are multi-pass while Quote> > C compilers OTOH are 1.5+1 pass: when compiling, it Quote> but in any case, there's no such thing as a 0.5 pass. time you include the module (precompiled headers may help here), in order to get the interface. OTOH, .TPU keeps the interface in compiled form. So I use the fractal term to explain that in C, you have to repeatedly process the first part (interface) of every module, while with TP this processing is transparent. Quote> > Previous C compilers did have (gcc still has, for some months) a output of the pre-processor is stored on disk to be re-read from the beginning by the parser... And C definitively needs a preprocessor, which is quite distinct from the main compiler. Antoine |
Vortex Vande
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?"Marco van de Voort" <mar...@toad.stack.nl> wrote in message Quote> >> Well in the "old" days :) tp shat all over most/all c compilers for Quote> Interesting. Can you name examples, on what generic 16-bit C compilers string handeling and c string handeling, tp beat it in arears such as this.. c may be fast but tp screams because of it's "limited" design concepts such as max 255 string sizes etc. a loop/indexing rou{*word*249} is faster than a conditional/jmp on the intel.. Quote> >My impression is not that C compilers did improve in the area of Quote> >> The underlying design of pascal is that it's a ONE pass compiler i.e for pascal right. all that "linking" dose is add an exe header and so on if you don't make .com files. so I don't think thats the compiler it's the os's fault so "linking" is joing your compiler code to the os's format of executable. [..CUT..] Quote> 3 semantic analysis (ok, simpler in C :-) least that's what I thort :) Quote> >Previous C compilers did have (gcc still has, for some months) a - Hide quoted text - - Show quoted text - Quote> Gcc's deadly slowlyness, stemms IMHO from two reasons: dose Quote> Also a bit odd. Two different C compilers that use different formats on that was called "swallow" I think (I could check the name but can't be stuffed).It's made by some shareware guy. |
Antoine Lec
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?Marco van de Voort wrote: Quote
Speed of produced binary: you take *any* algorithm, and my take is that 98 times out of 100, more than 80% of the .EXE produced by 16-bit C compilers (in large model, obviously) will perform better than TP7 .EXE. This is so because TP7 do very very few optimisations. Size: my take here is that the core code (what you wrote yourself, as Quote> >My impression is not that C compilers did improve in the area of they did, and this evolution is repeating again and again (so next compilers will be slower). Fortunately, new hardware runs much quicker, so the overall result is more than usable. Quote> >> The underlying design of pascal is that it's a ONE pass compiler i.e you We speak of different things. You speak about phases. Vortex and I speak See my other post about details about the .5 notation. Quote> 1 scanning (preprocessing, external in C mostly) Quote> 2 parsing (building tree) Quote> 3 semantic analysis (ok, simpler in C :-) are talking about tree level optimisation (if you mean strength reduction here, then TP has it too...) Quote> 3 tree level optimization (small in FPC atm. Need new CG and Thanks to "me@here" to correct me on this one. Quote> 4 code generation really a generic code generator that writes (on memory) some generic code for some virtual machine, which is then processed by a dedicated tool that targets a defined architecture? Looks like weird. Quote> 5 assembler generator few reasons to do differently, but some of them are still in force: - need to review easilly what the code generator produces (should not be a point if tools were not evolving constantly, 'cause that is just a point for the developpers of the compiler...) - need to embeed easily assembly code (with "as" at the end, assembler code is copied directly to the output Quote> 6 assembler optimiser source rather than on the intermediary code produced by step 4? I know this *is* possible (and probably it is the traditional design of V7 and/or pcc), but it does not look like the best option to me, particularly when you have such a detailled scheme as the one you drew. Quote> 7 assembler writer (pipe in gcc, internal stream when using binwriter in some ways in memory (or on file?), and then is readed and a different process which itself produces the assembly text? Quote> 8 assembler step of datas at the right place and adjustiment of pointers. Quote> >A bigger point is the format of the intermediary files: C traditionnaly .OBJ, and relocatable OMF is a so weird format that it turns to be a major hindrance to them. Unfortunately (?), the few C compilers that forget about that, and use proprietary format, never succeed. I think openness was a requisite when you use C (for example, I often used both M$ CL and TC/BC, the latter for developping and the former for the release because of the quality of the resulting code; C portability is a major point here). Quote> >OTOH, TP use a private format that [ 32-bit TP7 ] Quote> >Its name are FreePascal, Perhaps is it time to look at it, so... Antoine |
gdem..
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Linking C in Turbo Pascal or Borland Pascal?Marco van de Voort: Quote> Gcc's deadly slowlyness, stemms IMHO from two reasons: the body (=implementation) part if you have a pragma Inline for *one* procedure and you have switched the cross-unit inlining option! Slow compilation (on a <= Pentium-S) but a must for having even more speed in the code... ____________________________________________________ Sent via Deja.com http://www.deja.com/ |
1. Linking (turbo) C in Borland pascal 7.0
2. difference between TURBO PASCAL & BORLAND PASCAL
3. Pascal genie/ Borland turbo pascal
4. WTB: Turbo Pascal (or Borland Pascal) v7 DOS
5. turbo pascal/borland pascal
6. Borland Turbo Pascal vs Pascal with Objects
7. I would like to know the difference between Borland Pascal 7.0 and Turbo Pascal 7.0
8. WTB: Turbo Pascal (or Borland Pascal) v7 DOS
9. Turbo Pascal 7.0 vs Borland Pascal 7.0
10. WTD - Borland/Turbo Pascal Manuals/SW Especially Turbo Vision