
Linking Pascal routines into C programs
I've got some legacy metaware Pascal routines that I want to call MS Visual
C (required). Changes to the method of invoking the routines would be OK,
but I want to avoid changing any code internal to the routines. These
routines written as pascal programs without bodies, and the original intent
was to call these routines from assembly. A typical program containing
callable routines is shown below:
program prog;
var ... { I assumed these variables are local to this program}
procedure X(..); external;
procedure X(..);
begin
....
end;
procedure Y(..); external;
procedure Y(..);
begin
....
end;
. { Note the period here with no program begin/end}
I assume that this is metaware's version of a unit at the time the code was
written. Later metaware came out with Ada-like packages. Here are my
questions.
1) Is there an existing compiler that can handle this style of code as is?
Metaware no longer offers pascal support.
2) If I did change the program to a unit or equivalent structure (or even if
it could be compiled as is), how would I call it from Visual C. I have been
able to create C obj files in GCC and successfully link them into Visual C.
Thanks in advance,
Jim.