HP SunSoft Pascal 4.0 Instrukcja Użytkownika Strona 179

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 333
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 178
The C++–Pascal Interface 155
7
Procedure Calls: Pascal–C++
A Pascal main program can also call C++ functions. The following examples
show you how to pass simple types and arguments and include the commands
that are used to compile and execute the final programs.
Arguments Passed by Reference
Pascal arguments can be passed by reference. Here we discuss how they work
with C++.
The C++ main program,
IOMain.cc
#include <stdio.h>
extern "C" {
void IO ();
};
int main(void)
{
IO ();
printf ("Hello, C++ ! \n");
}
The commands to compile and
execute IO.p and IOMain.cc
hostname% pc -c IO.p
hostname% CC IO.o IOMain.cc -lpc
hostname% a.out
Hello, Pascal & St.Petersburg !
Hello, C++ !
Przeglądanie stron 178
1 2 ... 174 175 176 177 178 179 180 181 182 183 184 ... 332 333

Komentarze do niniejszej Instrukcji

Brak uwag