May 23, 2019, 06:56:22 am

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Source code doesn't work

Started by Techno, September 14, 2007, 02:35:02 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techno

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?

Code Select

/**************************************************/
/***                                            ***/
/*** 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?

LarryMc

Techno,
Where did you see it said that Aurora is a "c" compiler?

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ExMember001

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

peaslee

A quick look at Paul's tutorial in the help system would be useful.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Rock Ridge Farm (Larry)

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.

Techno

The syntax I think C or C++  right?

Ionic Wind Support Team

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?



Ionic Wind Support Team

Techno