comp.lang.ada
 help / color / mirror / Atom feed
From: nasser@apldbio.com
Subject: Re: linking C functions into GNAT ADA95 progs...
Date: 1996/10/26
Date: 1996-10-26T00:00:00+00:00	[thread overview]
Message-ID: <54v0jf$o9n@lex.zippo.com> (raw)
In-Reply-To: mheaney-ya023180002610962135490001@news.ni.net


>
>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







      reply	other threads:[~1996-10-26  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-26  0:00 linking C functions into GNAT ADA95 progs William Lane
1996-10-26  0:00 ` Matthew Heaney
1996-10-26  0:00   ` nasser [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox