From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,97ce41cf36cbf5ee X-Google-Attributes: gid103376,public From: nasser@apldbio.com Subject: Re: linking C functions into GNAT ADA95 progs... Date: 1996/10/26 Message-ID: <54v0jf$o9n@lex.zippo.com>#1/1 X-Deja-AN: 192526240 references: <54rph9$4gl@hatathli.csulb.edu> organization: Perkin-ELmer newsgroups: comp.lang.ada Date: 1996-10-26T00:00:00+00:00 List-Id: > >In article <54rph9$4gl@hatathli.csulb.edu>, wlane@csulb.edu (William Lane) >wrote: > >> I'm a beginning ADA95 programmer who's >>interested in linking in some Borland C++ v2.0 >>functions. These functions just play songs >>(via the soundon(), soundoff(), and delay() >>functions) and clear the screen. I've gleaned >>from Dr. Feldman's book that it is possible >>to link c functions in w/my ADA95 code, but >>since the library and header files differ from >>Borland C++ and DJGPP it I'm stumped. I was >>thinking of simply having my ADA95 program >>call the C++ routines as external modules by >>that is too slow... I think calling C++ class methods from Ada will take more efforts than to calling plain old C functions. (it is the extra hidden parameter, i.e. "this" that is the problem) don't know the detailes on this, someone else can elaborate. I've seem to have seen a paper on this subject ie. how to use/call/interface to C++ classes from Ada but dont remember more on this right now. As far as linking Ada to C functions, Both the Ada and the C compiled code must be of the same object file format, else how can one link an object module generated by one compiler to object module generated by different compiler if the compilers do not agree on the object file format? so unless gcc or djgpp generates the same object file format as VC++ or BC++ for the platform you are on (windows), it will not work. with GNAT, you can link Ada to C when using gcc to compile for the C code, since GNAT uses the same backend as gcc, so the object files have the same format, and they can be linked. Has any one linked GNAT Ada main program to a C function where the C function was compiled with say VC++ or BC++ or something other than gcc ? if so, how? sorry I can't answer your specific questions on djgpp. thanks, Nasser