comp.lang.ada
 help / color / mirror / Atom feed
* linking C functions into GNAT ADA95 progs...
@ 1996-10-26  0:00 William Lane
  1996-10-26  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 3+ messages in thread
From: William Lane @ 1996-10-26  0:00 UTC (permalink / raw)



	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... 
		thanks in advance,
				-Bill Lane





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linking C functions into GNAT ADA95 progs...
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Heaney @ 1996-10-26  0:00 UTC (permalink / raw)



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

What do mean by "too slow": execution speed or development time?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
mheaney@ni.net
(818) 985-1271




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linking C functions into GNAT ADA95 progs...
  1996-10-26  0:00 ` Matthew Heaney
@ 1996-10-26  0:00   ` nasser
  0 siblings, 0 replies; 3+ messages in thread
From: nasser @ 1996-10-26  0:00 UTC (permalink / raw)



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







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-10-26  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox