C TO DELPHI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ekremkocak
Posts: 20
Joined: Sat Feb 21, 2015 10:39 am

C TO DELPHI

Post by ekremkocak »

Topic closed
Last edited by ekremkocak on Mon Dec 27, 2021 8:56 am, edited 1 time in total.
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: C TO DELPHI

Post by nullplan »

The conversion is trivial. What in particular are you having trouble with?

May I add that this code is pretty poor. It does not take care of alignment properly, and it statically allocates the memory pool. And to a really small size. The code has no way to take advantage of any additional memory installed. The best-fit algorithm is going to be very slow, and since there is currently no code to unify adjacent freed memory blocks, the whole thing will fragment itself into oblivion.
Carpe diem!
ekremkocak
Posts: 20
Joined: Sat Feb 21, 2015 10:39 am

Re: C TO DELPHI

Post by ekremkocak »

Topic closed
Last edited by ekremkocak on Mon Dec 27, 2021 8:57 am, edited 1 time in total.
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: C TO DELPHI

Post by nullplan »

Again, what, in particular, are you having trouble with? Or are we just supposed to do your homework for you?

Also, are you aware that at least FreePascal has extensions to enable calling a C function from Pascal, and I am sure Delphi also provides that if you prod it enough? So what is even the point of such translation except academic exercise?
Carpe diem!
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: C TO DELPHI

Post by System123 »

There are many OS's written in FreePascal which would give you a good place to start looking for what you need - however, I'd strongly suggest trying to write this from scratch rather than just copying/translating code from other people. There is far more learning in writing from scratch and then comparing than the other way around.

If you are interested here is the base of an OS I was building in FreePascal many years ago - perhaps it is useful to you for learning. https://github.com/system123/gizmicos.git
Gizmic OS
Currently - Busy with FAT12 driver and VFS
ekremkocak
Posts: 20
Joined: Sat Feb 21, 2015 10:39 am

Re: C TO DELPHI

Post by ekremkocak »

Topic closed
Last edited by ekremkocak on Mon Dec 27, 2021 8:57 am, edited 1 time in total.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: C TO DELPHI

Post by Schol-R-LEA »

ekremkocak wrote:Friends, there are dozens of examples in c and FreePascal, but unfortunately there are no examples made with Delphi. I am trying to write in delphi.
Thing is, Delphi isn't a language, it is a compiler, IDE, and RAD tool for Object Pascal - the same language which FreePascal is a compiler for (there is a corresponding IDE for FreePascal, called Lazarus, but it is a separate project). FreePascal was developed to be closely compatible with Delphi code, as well.

While there are some differences (since FreePascal also supports a few other Pascal dialects), for the most part Delphi and FreePascal can compile the same code.

Does Delphi have a freestanding mode, though? I was always under the impression that Delphi (unlike FreePascal) was Windows-specific and could not generate freestanding code, which is necessary for OS development. If it does, all good, I just wasn't aware if it did or not.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: C TO DELPHI

Post by iansjack »

ekremkocak wrote:Friends, there are dozens of examples in c and FreePascal, but unfortunately there are no examples made with Delphi.
Do you suppose there is a reason for that?
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: C TO DELPHI

Post by Ethin »

Op, why did you wipe out all your posts content and replace it with "Topic closed"? For one, you can't "close" a topic -- only moderators/administrators can do that, and from what I can tell your not either of those. And two, it makes it impossible for anyone to know what you wrote before (this forum isn't a wiki after all). Which means that anyone who comes across this topic has to try and figure out what you initially wrote before you wiped out all the content in your posts for no reason.
Post Reply