boz@eleazar.dartmouth.edu (John Boswell) (06/17/89)
Hi. I am in the process of writing a program that will do curve-fitting to various functions. My problem is that I only really speak Pascal but all of the actual number-crunching routines I am using (culled from the literature) are in C. Is there a way I can compile the C functions, and then somehow link them to my Pascal program when I compile it? In other words, can you call C procedures from Pascal? There is some mention of being able to call Assembly-language routines that you compile with ThinkC; can I call C routines? Any help along these lines would be *greatly* appreciated. Thanks. ************************************************************************* John Boswell boz@eleazar.dartmouth.edu Dept. of Chemistry boz@dartCMS1.BITNET Dartmouth College, Hangover, Nude Hampster 03755
siegel@endor.harvard.edu (Rich Siegel) (06/17/89)
In article <13972@dartvax.Dartmouth.EDU> boz@eleazar.dartmouth.edu (John Boswell) writes: >Hi. Hi yourself. >are in C. Is there a way I can compile the C functions, and then somehow >link them to my Pascal program when I compile it? In other words, can you If you're using THINK C 3.0 and later, and THINK Pascal 2.0 or later, you can compile your C routines into a library, and add the library to the THINK Pascal project. The C routines must follow these conventions: - They must be declared as "pascal", as in "pascal void foo(a,b)" or "pascal long bar(z)". - They can't use string constants or floating-point literals. If you want access to Pascal global variables, just declare them as "extern" in your C code, and in your Pascal interfaces, put them in the interface-part. --Rich ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel I classify myself as a real developer because my desk is hip-deep in assembly-language listings and I spend more than 50% of my time in TMON. ~~~~~~~~~~~~~~~