IonicWind Software

Aurora Compiler => Coding Help - Aurora 101 => Topic started by: Techno on September 14, 2007, 02:35:02 PM

Title: Source code doesn't work
Post by: Techno on September 14, 2007, 02:35:02 PM
Dear programmers

Aurora works with C code and I have paste C code into the Aurora and I try to compiled but it doesn't work. What is wrong with this sourcecode?


/**************************************************/
/***                                            ***/
/*** TEST.c  -- test interface to inpout32.dll  ***/
/***  ( http://www.logix4u.net/inpout32.htm )   ***/
/***                                            ***/
/*** Copyright (C) 2003, Douglas Beattie Jr.    ***/
/***                                            ***/
/***    <beattidp@ieee.org>                     ***/
/***    http://www.hytherion.com/beattidp/      ***/
/***                                            ***/
/**************************************************/


/*******************************************************/
/*                                                     */
/*  Builds with Borland's Command-line C Compiler      */
/*    (free for public download from Borland.com, at   */
/*  http://www.borland.com/bcppbuilder/freecompiler )  */
/*                                                     */
/*   Compile with:                                     */
/*                                                     */
/*   BCC32 -IC:\BORLAND\BCC55\INCLUDE  TEST.C          */
/*                                                     */
/*                                                     */
/*  Be sure to change the Port addresses               */
/*  accordingly if your LPT port is addressed          */
/*  elsewhere.                                         */
/*                                                     */
/*******************************************************/




#include <stdio.h>
#include <conio.h>
#include <windows.h>


/* Definitions in the build of inpout32.dll are:            */
/*   short _stdcall Inp32(short PortAddress);               */
/*   void _stdcall Out32(short PortAddress, short data);    */


/* prototype (function typedef) for DLL function Inp32: */

     typedef short _stdcall (*inpfuncPtr)(short portaddr);
     typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);

int main(void)
{
     HINSTANCE hLib;
     inpfuncPtr inp32;
     oupfuncPtr oup32;

     short x;
     int i;

     /* Load the library */
     hLib = LoadLibrary("inpout32.dll");

     if (hLib == NULL) {
          printf("LoadLibrary Failed.\n");
          return -1;
     }

     /* get the address of the function */

     inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");

     if (inp32 == NULL) {
          printf("GetProcAddress for Inp32 Failed.\n");
          return -1;
     }


     oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");

     if (oup32 == NULL) {
          printf("GetProcAddress for Oup32 Failed.\n");
          return -1;
     }


/***************************************************************/
/* now test the functions */

     /* Try to read 0x378..0x37F, LPT1:  */

     for (i=0x378; (i<0x380); i++) {

          x = (inp32)(i);

          printf("port read (%04X)= %04X\n",i,x);
     }



     /*****  Write the data register */

     i=0x378;
     x=0x77;

     (oup32)(i,x);

     printf("port write to 0x%X, datum=0x%2X\n" ,i ,x);

     /***** And read back to verify  */
     x = (inp32)(i);
     printf("port read (%04X)= %04X\n",i,x);



     /*****  One more time, different value */

     i=0x378;
     x=0xAA;

     (oup32)(i,x);

     printf("port write to 0x%X, datum=0x%2X\n" ,i ,x);

     /***** And read back to verify  */
     x = (inp32)(i);
     printf("port read (%04X)= %04X\n",i,x);




     FreeLibrary(hLib);
     return 0;
}



Can someone help me what is wrong?
Title: Re: Source code doesn't work
Post by: LarryMc on September 14, 2007, 02:39:59 PM
Techno,
Where did you see it said that Aurora is a "c" compiler?

Larry
Title: Re: Source code doesn't work
Post by: LarryMc on September 14, 2007, 02:44:48 PM
Techno,
There is a big difference between saying Aurora has " a syntax similar to C++ " and saying Aurora "is a C compiler".

I don't know what ever gave you that idea.

Larry
Title: Re: Source code doesn't work
Post by: LarryMc on September 14, 2007, 02:47:17 PM
Techno,
It still appears tha you haven't bothered to read the Aurora Help files nor go through all the example programs looking at their syntax and structure.

I suggest, again, that you do that.

Larry
Title: Re: Source code doesn't work
Post by: ExMember001 on September 14, 2007, 02:50:09 PM
Aurora is a C like langage but its not compatible with C langage.
So you can't paste C codes in Aurora IDE and compile, you have to do some translations

ASM (Assembly) is the only external langage that can be use directly in your code, because your code at the end will be assembly ;)
Title: Re: Source code doesn't work
Post by: Bruce Peaslee on September 14, 2007, 03:02:18 PM
A quick look at Paul's tutorial in the help system would be useful.
Title: Re: Source code doesn't work
Post by: Rock Ridge Farm (Larry) on September 14, 2007, 11:54:53 PM
Where did you get that idea? Aurora is not C and C is not Aurora - never has been and I suspect they never will be
cross compilable.
Title: Re: Source code doesn't work
Post by: Techno on September 15, 2007, 12:21:52 AM
The syntax I think C or C++  right?
Title: Re: Source code doesn't work
Post by: Ionic Wind Support Team on September 15, 2007, 07:00:53 AM
Stephane you are beginning to aggravate me, begause again you are not reading the replies or following the suggestions of those that do reply. ::)

Aurora is Aurora syntax,  C is C syntax, C# is C# syntax, java is java syntax, get it?



Title: Re: Source code doesn't work
Post by: Techno on September 15, 2007, 10:53:33 AM
Thank you for your repleys