473,503 Members | 1,625 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 1593
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.********@comAcast.net> wrote in message news:<oQ*****************@newsread1.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
3937
by: Shri | last post by:
Can anybody tell me where i can find a detailed document on #pragma .... --shri
1
3040
by: Gustavo L. Fabro | last post by:
Greetings! Going directly to the point: myclass.h: //-------------------------------------- #pragma managed //Forward declaration
11
2844
by: ramu | last post by:
HI, Can anyone tell me about pragma? And can u give an example of how to use it?
15
3734
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...
5
3593
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...
26
3783
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? ...
5
3984
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...
2
3896
by: aleemakhtar1 | last post by:
wat is use of pragma directive in embedded sys ??
0
10670
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...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7441
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...
0
5558
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,...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
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...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
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...

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.