jc58+@andrew.cmu.edu (Johnny J. Chin) (11/10/88)
Does anyone out there know how to call Turbo C code from Turbo Pascal 4.0? Any suggestions would be greatly appreciated. I'm just a beginner at Turbo C (started programming with it a few months ago), but am pretty good with Turbo Pascal. The version of Turbo C that I have is 1.0 and Turbo Pascal is 4.0. Thanks in advance for any suggestions. -- J. Chin (a.k.a. Computer Dr.) 4730 Centre Avenue, Apt. #412 ARPAnet: Johnny.J.Chin@andrew.cmu.edu Pittsburgh, Pennslyvania 15213 BITnet: jc58@andrew.BITNET (412) 268-8936 UUCP: ...!harvard!andrew.cmu.edu!jc58
wew@naucse.UUCP (Bill Wilson) (11/11/88)
> Does anyone out there know how to call Turbo C code from Turbo Pascal 4.0? > Any suggestions would be greatly appreciated. > > I'm just a beginner at Turbo C (started programming with it a few months > ago), but am pretty good with Turbo Pascal. The version of Turbo C that I > have is 1.0 and Turbo Pascal is 4.0. > Linking Turbo C routines to Turbo Pascal is well documented in the Turbo C manual. If you own one there is a section on the topic and if I remember correctly, there are example files also. Generally in Turbo C you must make sure that you use the correct parameter/calling sequence when passing arguments back and forth from Pascal to C. -- Bill Wilson (Bitnet: ucc2wew@nauvm) Northern AZ Univ Flagstaff, AZ 86011 {These views are mine and do not necessarily reflect those of my employer}
jc58@andrew.cmu.edu (J. Chin) (11/11/88)
------------ In the message I got from Daniel Smith: >If I remember correctly the 4.0 Manual has several examples of >interfacing Turbo C and Turbo Pascal. I have been through the Turbo Pascal 4.0 manual several times and couldn't find anything on interfacing Turbo C with Turbo Pascal. The only thing that I saw (if I remember correctly) was how to interface Assembly with Turbo Pascal. Also, I don't seem to recall anything in the Turbo C (ver 1.0) manual regarding interfacing with Pascal; in the sense of having C procedures called by a Pascal program. If anyone has a sample of a simple program that they've written in Turbo Pascal which calls a C subroutine, I'd like to see it. If the C subroutine was written in Turbo C, could you also tell me what you had setup in C so that the code generated was compatible with Turbo Pascal? Thanks for you replies. Keep them coming, hopefully I'll get a hold of this soon. Once again, thanks. -- J. Chin (a.k.a. Computer Dr.) ------------------------- Carnegie Mellon University ------------------------- 4730 Centre Avenue, Apt. #412 ARPAnet: Johnny.J.Chin@andrew.cmu.edu Pittsburgh, Pennslyvania 15213 BITnet: jc58@andrew.BITNET (412) 268-8936 UUCP: ...!harvard!andrew.cmu.edu!jc58 ------------------------------------------------------------------------------
jc58+@andrew.cmu.edu (Johnny J. Chin) (11/11/88)
First, thanks for your reply. Second, don't mean to be gripey, but I read that section in the manual and it doesn't help. What I did was create a simply procedure in Turbo C to remove all the blank space from the end of a string. I then compiled it to an OBJ file. In may Pascal code, I linked it like the book says. But it then comes back and tells me something like SPRINTF not found (or something like that). Now ... I did use SPRINTF in my C code. Why didn't it compile the SPRINTF? Is there something that I'm missing? Any and all help is appreciated. Thanks. -- J. Chin (a.k.a. Computer Dr.) ------------------------- Carnegie Mellon University ------------------------- 4730 Centre Avenue, Apt. #412 ARPAnet: Johnny.J.Chin@andrew.cmu.edu Pittsburgh, Pennslyvania 15213 BITnet: jc58@andrew.BITNET (412) 268-8936 UUCP: ...!harvard!andrew.cmu.edu!jc58 ------------------------------------------------------------------------------
rbw@williams.edu (11/12/88)
In the sample source code that comes with the TP4.0 release there is an example of a Turbo C routine that could be linked to a Pascal routine. I don't remember the name right now, but it is there. -Richard Ward rbw@cs.williams.edu Williams College, Williamstown, MA
milne@ics.uci.edu (Alastair Milne) (11/13/88)
I don't know whether it's discussed in the manual -- I will not pretend to have read the whole thing -- but there is a demo among the discs you received in your release. I believe it's commented reasonably well, but assumes that you have Turbo C and the libraries. If the comments don't say how to get the C libraries for linking, I suggest you go into the Environment menu, find the list of Unit directories, and add to it the directory containing the C libraries. That's just a guest, as I've never yet been compelled to use C with Turbo -- but I have seen the example. Good luck. Alastair Milne