Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Using a dll in a custom dissector

From: wsgd <wsgd@xxxxxxx>
Date: Mon, 02 Mar 2009 21:01:32 +0100

packet-foo.c(234) : error C2143: syntax error : missing ')' before 'type'

234 is the line where appears the problem.
Look at this line.

Perhaps you can find more help on forums about windows and C/C++.


Olivier

gogrady@xxxxxxxxx a �crit :
hello,

I'm just learning about dll's and have created a custom dissector. I was hoping someone could help clear up using a dll with my dissector. I'm currently using LoadLibrary() and i have just started trying to use the dll. My dll will be using 2 other .lib's. Is it possible to create a variable in the dll and have functions that can be used by the dissector plugin to set it and manipulate it without having direct access to it? I have tried to do so since it is a class that i am trying to manipulate, which you cant do in c. The dll is written in c++. Also, i'm having a bit of trouble using the functions in my dissector. Here is some sample.
after the #includes:
typedef void  (*CreateProxy)( const BYTE*, int );
typedef char * (*GetMsgName)( void );
GetMsgName			_GetMsgName;
CreateProxy			_CreateProxy;
HINSTANCE			LoadProxy;

void
load_DLL(void)
{

	LoadProxy = LoadLibrary(TEXT("IComProxy.dll"));
	if (LoadProxy != NULL) /** then load functions */
	{	
		_CreateProxy = (CreateProxy)GetProcAddress(LoadProxy, "CreateProxy");
		_GetMsgName = (GetMsgName)GetProcAddress(LoadProxy, "GetMsgName");
	}

}

void
unload_DLL(void)
{
	FreeLibrary(LoadProxy);
}

//in static void dissect_icom
void *target;
char *msg;
target = tvb_memdup(tvb, offset, data_length);
(_CreateProxy)( (const BYTE*)target, data_length); //creates an object in the dll
msg = (_GetMsgName)( void ); //should call a function in the object created in the dll to return a char *

but i get:
packet-foo.c(234) : error C2143: syntax error : missing ')' before 'type'
packet-foo.c(234) : error C2059: syntax error : ')'

Thanks for any help,
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




--
Wireshark Generic Dissector http://wsgd.free.fr