Wireshark-dev: Re: [Wireshark-dev] Calling C++ files from C dissector
From: "Behdad Forghani" <behdad.forghani@xxxxxxxxx>
Date: Mon, 2 Feb 2009 12:58:17 -0500
Let's say you want to write a function x with C calling function to call a function called y in a C++ libarary. In file x.cpp, declare extern "C" void x() { y(); } In Wireshark call x. Link Wireshark, x and library together. -----Original Message----- From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of gogrady@xxxxxxxxx Sent: Monday, February 02, 2009 12:25 PM To: wireshark-dev@xxxxxxxxxxxxx Subject: Re: [Wireshark-dev] Calling C++ files from C dissector Sorry, a bit over my head. so declare the functions i'm going to use in the library with extern? what if i can't change anything in the library, i was hoping that i could create a third file that i could use. So my dissector -> third file -> library. would i use extern in the third file and then not need it in the library functions? and what do you mean by linking it to my code? Sorry, like i said, not very experienced Greg -------------------------------------------------- You need to declare your function to use C calling convention using extern "C" declaration and then you can link it into your code. -----Original Message----- From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of gogrady@xxxxxxxxx Sent: Monday, February 02, 2009 12:09 PM To: wireshark-dev@xxxxxxxxxxxxx Subject: [Wireshark-dev] Calling C++ files from C dissector Hello, So i'm writing a custom dissector. I have a library for a custom protocol which has functions i need to call. What i want to do is take the raw data, send it to the library, and the library will send back the useful information for output. I've written the dissector code for getting the raw data, but now i don't know how to call the library. I want to create a proxy, or another file that i will use to call the library so my dissector isnt interacting directly with the library. I'm not sure how i even start to do this. any help would be greatly appreciated, i'm new to C/C++. Thank, Greg ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
- References:
- Re: [Wireshark-dev] Calling C++ files from C dissector
- From: gogrady
- Re: [Wireshark-dev] Calling C++ files from C dissector
- Prev by Date: Re: [Wireshark-dev] Calling C++ files from C dissector
- Next by Date: Re: [Wireshark-dev] Calling C++ files from C dissector
- Previous by thread: Re: [Wireshark-dev] Calling C++ files from C dissector
- Next by thread: Re: [Wireshark-dev] Calling C++ files from C dissector
- Index(es):