473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Get calling function in a function?

Hello there,

I have a quick question:

When calling a function B from within a function A, is it possible get
information about the calling function A (e.g. name, values passed over
etc) from within the function B?

The reason why I am asking, is, for example when handling exceptions or
logging errors so I know what exactly happened.
Thanks and all the best,
-joerg

May 19 '06 #1
2 1295
Joerg Battermann wrote:
When calling a function B from within a function A, is it possible get
information about the calling function A (e.g. name, values passed over
etc) from within the function B?
"Name"? - Yes.
"Values" passed over - No.
The reason why I am asking, is, for example when handling exceptions or
logging errors so I know what exactly happened.


Like me, you've discovered that "Good" code doesn't just break, it get's
broken by "Bad" data - and that's conspicuously /missing/ from .Net's
built-in StackTrace.

I'd suggest building your own module to augment the built in StackTrace,
marking the entry and exit points of each [major] method (/with/
arguments and return values), but it would have to be a Global thing
within each application - you don't want to be passing it around into
practically every function - don't know if that would be an issue for you.

HTH,
Phill W.
May 19 '06 #2
Phil,

thanks for the reply. I'll give the later one a try (because the value
often is the critical part in my case). For others who need reference,
here's some information concerning .net's stacktrace:

http://www.codeproject.com/dotnet/MethodName.asp
http://www.codeproject.com/vb/net/vbnettrace.asp
http://msmvps.com/blogs/manoj/archiv...3/25/4191.aspx

All the best,
-Joerg

May 22 '06 #3

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

Similar topics

8
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
14
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() '...
15
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which...
1
Airslash
by: Airslash | last post by:
Touchy subject I know, but I'm currently trying some stuff to understand Threads better in C++. I've read the Windows API documentation regarding Threads, and want to build a Thread class that can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.