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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: .h header file in ObjectAda 8.2.2 source code? Date: Fri, 19 Jul 2013 16:02:56 +0300 Organization: Tidorum Ltd Message-ID: References: <54f7f0d4-29ef-4de0-94d8-8320e8df24e2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net Dj0R03uQRtJNUkby0O6yCgp4Amn5GE4vLrqDz9dKHE/zEtSJQ9 Cancel-Lock: sha1:UrVubnnTB70JN6NNvLISQzeoU4I= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <54f7f0d4-29ef-4de0-94d8-8320e8df24e2@googlegroups.com> X-Original-Bytes: 3059 Xref: number.nntp.dca.giganews.com comp.lang.ada:182588 Date: 2013-07-19T16:02:56+03:00 List-Id: On 13-07-19 14:47 , dd24fan wrote: > Hi, all! I currently have this requirement to include a .h file in > the ObjectAda source code. I'm not quite sure how to do this. That depends on what the .h file contains... in C, it can contain any kind of C code. I've seen C programs in which the .h files contain large chunks of executable code, both in macros and in real functions. (Perhaps that C programmer thought that only .h files can be #included.) > Is this done by pragmas? Yes, for some .h information. Other information, such as type declarations, must be translated into ordinary Ada code (Ada type declarations), i.e. not (only) pragmas. Can you show us the .h file, or some of the parts of it that you are using? > Btw, in my source code now I've referenced > all the functions needed to communicate with the hardware via pragma > imports. That is the right way, for functions that are declared in the .h file and then called from the Ada code. Note that in addition to the Import pragmas for the functions, the parameter types may need Convention pragmas to make the Ada compiler follow C memory structures. Can you show an example of a C function declared in the .h file, and your corresponding Ada function (declaration)? > I've also included the .lib file the vendor suggests in my > project. Sounds like a necessary thing, although I don't know the details of how C libraries are included in ObjectAda programs. > When i try to run the executable in my test environment the .exe just > hangs. Any insight would be greatly appreciated. Not enough information... Where does it hang? Is any part of the Ada main subprogram executed? Does it hang in the first call to the C code? You speak of "communicating with hardware". Are special drivers involved? Does the C code use interrupts? Does the program run on a PC/Windows/Linux, or on an embedded bare-board system? Can you step through the code with a debugger? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .