Recent

Author Topic: Flattening Object Pascal to use within C  (Read 579 times)

giahung1997

  • Full Member
  • ***
  • Posts: 113
Flattening Object Pascal to use within C
« on: May 25, 2019, 04:54:28 pm »
How to? I know I would use the same procedure as flattening C++ to procedural styles C could understand. But give me an example. Tks.
Hate me? I'm gone. You will never see me again. Fuck the people of this forum! Fuck this Lazarus! Fuck Pascal!

jamie

  • Hero Member
  • *****
  • Posts: 1745
Re: Flattening Object Pascal to use within C
« Reply #1 on: May 25, 2019, 05:30:16 pm »
Object pascal  is much more powerful than C in that respect..

You would need lots of overhead functions created to simulate it..

jamie

  • Hero Member
  • *****
  • Posts: 1745
Re: Flattening Object Pascal to use within C
« Reply #2 on: May 25, 2019, 05:38:51 pm »
To add to that, you would  need a Struct to how all the variables and all functions related to that simulated class would
need a minimum parameter to pass the instance copy of the data to it.

 all references to the struct members would be done via that Reference.

 after do this, you can the use the same functions with many different instances..
etc

julkas

  • Sr. Member
  • ****
  • Posts: 300
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Flattening Object Pascal to use within C
« Reply #3 on: May 25, 2019, 05:44:06 pm »
How to? I know I would use the same procedure as flattening C++ to procedural styles C could understand. But give me an example. Tks.
Can you give more information about your project, environment? What is your goal?
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7298
Re: Flattening Object Pascal to use within C
« Reply #4 on: May 25, 2019, 06:16:05 pm »
Example of what you tried and didn't work? It is hard explaining such complex issues with one line of text to go on.

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Flattening Object Pascal to use within C
« Reply #5 on: May 26, 2019, 08:17:02 am »
Example of what you tried and didn't work? It is hard explaining such complex issues with one line of text to go on.
Oh. I found someone created a simple binding of LCL to plain C on Lazarus CCR and want to help. If it really that hard I should give up  :)
Hate me? I'm gone. You will never see me again. Fuck the people of this forum! Fuck this Lazarus! Fuck Pascal!

jamie

  • Hero Member
  • *****
  • Posts: 1745
Re: Flattening Object Pascal to use within C
« Reply #6 on: May 26, 2019, 04:23:51 pm »
Please show what you are trying to convert?