Hi,
Please help me spot where I go wrong. I cannot understand why the error.
The Code with error and full error are below.
Thanks

Error:
loaddll.cpp:6: error: invalid conversion from 'void*' to 'void (*)(wxString)'

lines 5, 6 and 7

typedef void (*helloSteve)(wxString);//takes string and Shows it!
helloSteve myFunc = myDLL->GetSymbol(wxT("helloSteve"));
myFunc(wxT("The DLL Just Works!"));

My guess is that GetSymbol() returns a void*, and void* is not compatible with function pointers. Try a cast, you might get lucky.

helloSteve myFunc = reinterpret_cast<helloSteve>(myDLL->GetSymbol(wxT("helloSteve")));

You got it! Yes it is the issue

void* wxDynamicLibrary::GetSymbol  	(  	const wxString &   	 name,
		bool *  	success = 0	 
	) 			const

I think dynamic_cast is better than reinterpret_cast

Doesn't dynamic_cast only work with polymorphic types?

Not sure but may be you are right!
I used it and it failed and then I resorted to C-ish cast and it worked. Since it was just a test program I didn't bother ;)

This question has already been answered. Start a new discussion instead.