🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15046

Re: How to Define "extern" keyword in C++ Builder(Here is Complete Code)

#15046
From: Remy Lebeau (TeamB)
Date: Tue, 22 Jul 2003 23:49
31 lines
1994 bytes
"Umar Kazi" <umarkazi@yahoo.com> wrote in message
news:3f1dc4d5$1@newsgroups.borland.com...

> Actually I am trying to access input port while using windows XP.

Can't be done directly.  Windows is a protected OS.  Particular more so in
the NT family (NT, 2K, and XP).  Direct access to hardware is not allowed.
You need to use a device driver for that instead.

> void main()
> extern "C"
> {
> short __import __stdcall InpVal(378h);
> }

That is not valid code.  It is declaring a function named main() which
contains an inner function InpVal() inside of it.  C++ does not support
inner functions.  If all you are trying to do is call the InpVal() function
from within your program's main() function, then it should look more like
this instead:

    int main()
    {
        short s = InpVal(0x378);
        // use s as needed
        return 0;
    }


Gambit
Technical Details
Message-ID: <3f1dcc33$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f1db2db$1@newsgroups.borland.com> <3f1dbea7$1@newsgroups.borland.com> <3f1dc4d5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6fe63ea9ffe8bf86
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-22 16:49:50 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f1db2db$1@newsgroups.borland.com> <3f1dbea7$1@newsgroups.borland.com> <3f1dc4d5$1@newsgroups.borland.com>
Subject: Re: How to Define "extern" keyword in C++ Builder(Here is Complete Code)
Date: Tue, 22 Jul 2003 16:49:22 -0700
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f1dcc33$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058917427 207.175.226.26 (22 Jul 2003 16:43:47 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail