473,569 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Implement a Pragma.

Che
Hi,

I am unsure of this message should be posted here. If not please let
me know the appropriate group.

I was wondering how i could implement my own pragma.
Say #pragma to_asm_code {function_name}
{function_name} is an assembly routine. I believe some compilers
provide this feature by mechanism of "FastCall". I don't want anything
complicated. All I wish to do is the language must recognize this as a
pragma, push the return address and transfer control to the assembly
routine.

Thanks,
Che
Jul 22 '05 #1
3 1600
Che wrote:
I am unsure of this message should be posted here. If not please let
me know the appropriate group.

I was wondering how i could implement my own pragma. [...]


#pragma directive is defined to cause the preprocessor to behave in
some implementation-defined way, therefore there is nothing in the C++
language itself that would help you. You need to pose this question
to the developers of the compiler you're using.

I know one compiler for which you can get the source code: GNU C++.
You could add your special pragma to it if you feel that it's something
you need and/or want to do. After that you will have your own special
edition of the compiler or you could share it with everybody interested
by submitting your code back to GCC project folks. Try asking in
gnu.g++ or gnu.g++.help.

V
Jul 22 '05 #2


Che wrote:
Hi,

I am unsure of this message should be posted here. If not please let
me know the appropriate group.

I was wondering how i could implement my own pragma.
Say #pragma to_asm_code {function_name}
{function_name} is an assembly routine. I believe some compilers
provide this feature by mechanism of "FastCall". I don't want anything
complicated. All I wish to do is the language must recognize this as a
pragma, push the return address and transfer control to the assembly
routine.

Thanks,
Che


in this specific case you can just declare the function and call it, e.g.:

extern "C" void function_name() ;

then

function_name() to call it.

And that should do exactly what you need although you may have to add an
'_' character to the name in your assembly code.

the 'fastcall' pragma is I think a watcom C/C++ thing, what it means is
pass the arguments in registers instead of pushing them on the stack. It
doesn't do anything if you don't have arguments.

David
Jul 22 '05 #3
Che
Thanks Victor.

Victor Bazarov <v.********@com Acast.net> wrote in message news:<oQ******* **********@news read1.dllstx09. us.to.verio.net >...
Che wrote:
I am unsure of this message should be posted here. If not please let
me know the appropriate group.

I was wondering how i could implement my own pragma. [...]


#pragma directive is defined to cause the preprocessor to behave in
some implementation-defined way, therefore there is nothing in the C++
language itself that would help you. You need to pose this question
to the developers of the compiler you're using.

I know one compiler for which you can get the source code: GNU C++.
You could add your special pragma to it if you feel that it's something
you need and/or want to do. After that you will have your own special
edition of the compiler or you could share it with everybody interested
by submitting your code back to GCC project folks. Try asking in
gnu.g++ or gnu.g++.help.

V

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3952
by: Shri | last post by:
Can anybody tell me where i can find a detailed document on #pragma .... --shri
1
3054
by: Gustavo L. Fabro | last post by:
Greetings! Going directly to the point: myclass.h: //-------------------------------------- #pragma managed //Forward declaration
11
2856
by: ramu | last post by:
HI, Can anyone tell me about pragma? And can u give an example of how to use it?
15
3744
by: muttaa | last post by:
Hello all, I'm a beginner in C...May i like to know the difference between a #pragma and a #define.... Also,yet i'm unclear what a pragma is all about as i can find topics on it only in high-standard books...
5
3599
by: venkat | last post by:
Hi, I have come across the a pragma definition " #pragma switch direct ". I don't know any thing about pragma's. Even i when i search through google not getting exact information. what does pragma does?. what the statment "#pragma switch direct" does?. Thanks, Venkat.
26
3801
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? Thanks...
5
3989
by: _dwin | last post by:
Hi, Does anyone know how to implement your own preprocessor directive? For instance, I would like to have a directive which goes like: #<directive_name<parameters, ...> ie. #compress input_file output_file Thanks.
2
3910
by: aleemakhtar1 | last post by:
wat is use of pragma directive in embedded sys ??
0
10677
debasisdas
by: debasisdas | last post by:
PRAGMA:-Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time. They pass information to the compiler. A pragma is an instruction to the Oracle compiler that tells it to do something. In this case you are telling Oracle to associate an error that you choose to a variable that you...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.