Page 1 of 1
C TO DELPHI
Posted: Sat Dec 25, 2021 2:02 am
by ekremkocak
Topic closed
Re: C TO DELPHI
Posted: Sat Dec 25, 2021 3:01 am
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.
Re: C TO DELPHI
Posted: Sat Dec 25, 2021 5:23 am
by ekremkocak
Topic closed
Re: C TO DELPHI
Posted: Sat Dec 25, 2021 11:51 pm
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?
Re: C TO DELPHI
Posted: Sun Dec 26, 2021 9:20 am
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
Re: C TO DELPHI
Posted: Sun Dec 26, 2021 10:53 am
by ekremkocak
Topic closed
Re: C TO DELPHI
Posted: Sun Dec 26, 2021 11:35 am
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.
Re: C TO DELPHI
Posted: Sun Dec 26, 2021 12:12 pm
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?
Re: C TO DELPHI
Posted: Tue Dec 28, 2021 7:17 pm
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.