473,789 Members | 3,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1322
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
2965
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 p3); The parameters here can be read either in the forward order from p1 till p3 or reverse order from p3 till p1. Can anyone explain what is the advantage/disadvantage of either of
6
3314
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 in VBA from my other Access applications. This works fine and I'm quite happy with it... except for one area; error handling. In most of my functions I call an error handler which
14
3013
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() ' This method shows the form used to get the info If sWhereInt = "" Then DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
15
22868
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 could either be f1() or f2(). BRs!
1
1574
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 run any kind of function as a seperate thread by utilising function pointers. This is the code I currently have so far: header file //--------------------------------------------------------------------------- #ifndef ThreadH #define ThreadH
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6768
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
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
3
2909
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.