Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-09

FPC/Linux - how to link with c/c++ programs ?

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Piotr Skrzypczynski

Hello.
I'm new to this list, so sorry if I'm asking about obvious things..... Recently I've installed FPC 1.0 for Linux. It works fine - I have ported several of my old BP7/DOS programs, but now I want to know how to link procedures/libraries written in Pascal with c/c++ programs under Linux. Exactly, I need to link some numerical procedures I wrote in Pascal with a Linux program written in c++ (compiled with gcc). This is 3000+ lines of Pascal code so I'm looking for any other solution than convert it to c...

- Is it possible ?
- Where can I find any exapmles of such 'mixed' programs ?

Piotr Skrzypczynski

Reply by email

Unknown author
Show quoted text 11 lines
Hello. I'm new to this list, so sorry if I'm asking about obvious things..... Recently I've installed FPC 1.0 for Linux. It works fine - I have ported several of my old BP7/DOS programs, but now I want to know how to link procedures/libraries written in Pascal with c/c++ programs under Linux. Exactly, I need to link some numerical procedures I wrote in Pascal with a Linux program written in c++ (compiled with gcc). This is 3000+ lines of Pascal code so I'm looking for any other solution than convert it to c... - Is it possible ? - Where can I find any exapmles of such 'mixed' programs ?

It's atm. only possible to link c programs within pascal programs. C++ support will be worked on this year.

The other way using Pascal in C also needs some more research as the initialization code for Pascal needs to be called before you can use it. C uses .ctor and .dtor or something like that but there is no documentation about such things, so support still hasn't added

Reply by email

Michael Van Canneyt
to Piotr Skrzypczynski: Hello. I'm new to this list, so sorry if I'm asking about obvious things..... Recently…
Piotr Skrzypczynski wrote 10 lines
Hello. I'm new to this list, so sorry if I'm asking about obvious things..... Recently I've installed FPC 1.0 for Linux. It works fine - I have ported several of my old BP7/DOS programs, but now I want to know how to link procedures/libraries written in Pascal with c/c++ programs under Linux. Exactly, I need to link some numerical procedures I wrote in Pascal with a Linux program written in c++ (compiled with gcc). This is 3000+ lines of Pascal code so I'm looking for any other solution than convert it to c... - Is it possible ?

Yes, but not easy.

- Where can I find any exapmles of such 'mixed' programs ?

Best is to make a library, and link to it from C. See the reference manual or programmers manuals for how to do this.

Michael.

Reply by email

Michael Van Canneyt
to Unknown author: It's atm. only possible to link c programs within pascal programs. C++ support will be…
Show quoted text 19 lines
> Hello. > I'm new to this list, so sorry if I'm asking about obvious things..... > Recently I've installed FPC 1.0 for Linux. It works fine - I have ported > several of my old BP7/DOS programs, but now I want to know how to link > procedures/libraries written in Pascal with c/c++ programs under Linux. > Exactly, I need to link some numerical procedures I wrote in Pascal with a > Linux program written in c++ (compiled with gcc). This is 3000+ lines of > Pascal code so I'm looking for any other solution than convert it to c... > > - Is it possible ? > - Where can I find any exapmles of such 'mixed' programs ? It's atm. only possible to link c programs within pascal programs. C++ support will be worked on this year. The other way using Pascal in C also needs some more research as the initialization code for Pascal needs to be called before you can use it. C uses .ctor and .dtor or something like that but there is no documentation about such things, so support still hasn't added

For numerical routines it should function, though.

michael.

Reply by email