From: glitteringsounds on 9 Feb 2010 13:37 Hello, I need to call all global functions(probably several) that are exported in a DLL but using only single generic pointer. I am loading dll with LoadLibrary function and getting all exports with GetProcAddress, this needs to be type casted with that function pointer of which type the function is really itself. I don't know how many exported functions are there in DLL and how many no of parameters on which they are operating.This prevents me to define generic type of pointer for every function call working for GetProcAddress.(void* is possible but still we cannot generate function call, gives compile time error) This problem can be resolved when you have all member functions of some class. You can rely on 'this' of that class and function pointer can be declared of that class. Moreover all functions with single function pointer can be called with some boost API bindings. But for all global and EXPORTED functions of DLL, how this problem can be solved. Regards Muhammad Usman Khalil
From: D.Khasayev on 9 Feb 2010 15:04 Hello. Have you checked next variant: _asm{ push par1 push par2 ..... push parN call lpf } or jmp lpf, where lpf is pointer to the function. Good luck.
From: ScottMcP [MVP] on 9 Feb 2010 15:59 On Feb 9, 1:37 pm, glitteringsounds <muhammadusman.kha...(a)gmail.com> wrote: > Hello, > > I need to call all global functions(probably several) that are > exported in a DLL but using only single generic pointer. > I am loading dll with LoadLibrary function and getting all exports > with GetProcAddress, this needs to be type casted with that function > pointer of which type the function is really itself. > > I don't know how many exported functions are there in DLL and how many > no of parameters on which they are operating.This prevents me to > define generic type of pointer for every function call working for > GetProcAddress.(void* is possible but still we cannot generate > function call, gives compile time error) You need more than a function pointer to make a call. You also need to know the details of the call parameters. Obviously, it is impossible to store these details in a "single generic pointer." If you don't know the parameter details you cannot call the function.
From: glitteringsounds on 10 Feb 2010 03:34 On Feb 10, 1:59 am, "ScottMcP [MVP]" <scott...(a)mvps.org> wrote: > On Feb 9, 1:37 pm, glitteringsounds <muhammadusman.kha...(a)gmail.com> > wrote: > > > Hello, > > > I need to call all global functions(probably several) that are > > exported in a DLL but using only single generic pointer. > > I am loading dll with LoadLibrary function and getting all exports > > with GetProcAddress, this needs to be type casted with that function > > pointer of which type the function is really itself. > > > I don't know how many exported functions are there in DLL and how many > > no of parameters on which they are operating.This prevents me to > > define generic type of pointer for every function call working for > > GetProcAddress.(void* is possible but still we cannot generate > > function call, gives compile time error) > > You need more than a function pointer to make a call. You also need > to know the details of the call parameters. Obviously, it is > impossible to store these details in a "single generic pointer." If > you don't know the parameter details you cannot call the function. Respectfully Sir!! My goal to call every exported function of DLL without need to declare function pointers.If DLL contains 100 funcs(exported methods) having different types(i.e their return type and in/out params) I need 100 function pointers. Every time GetProcAddress needs to be type casted with those 100 func pointers. Creates horrible maintainaince nightmare. Every time new function included, you need pointer of that type to be declare in code. Wot about delegates..? Delegate usage prevents user to use GetProcAddress and require any function pointer to work with. It wraps all functions to which you want to call at run time. Thus we'll not need any function pointer or need to know the type for that pointer. Once we know the function Name,in/out params and their types, Without using GetProcAdress, we can call these functions using delegates. But for this we need to work in managed code sustains within C#.NET
From: glitteringsounds on 10 Feb 2010 03:36 On Feb 10, 1:59 am, "ScottMcP [MVP]" <scott...(a)mvps.org> wrote: > On Feb 9, 1:37 pm, glitteringsounds <muhammadusman.kha...(a)gmail.com> > wrote: > > > Hello, > > > I need to call all global functions(probably several) that are > > exported in a DLL but using only single generic pointer. > > I am loading dll with LoadLibrary function and getting all exports > > with GetProcAddress, this needs to be type casted with that function > > pointer of which type the function is really itself. > > > I don't know how many exported functions are there in DLL and how many > > no of parameters on which they are operating.This prevents me to > > define generic type of pointer for every function call working for > > GetProcAddress.(void* is possible but still we cannot generate > > function call, gives compile time error) > > You need more than a function pointer to make a call. You also need > to know the details of the call parameters. Obviously, it is > impossible to store these details in a "single generic pointer." If > you don't know the parameter details you cannot call the function. Respectfully Sir!! My goal to call every exported function of DLL without need to declare function pointers.If DLL contains 100 funcs(exported methods) having different types(i.e their return type and in/out params) I need 100 function pointers. Every time GetProcAddress needs to be type casted with those 100 func pointers. Creates horrible maintainaince nightmare. Every time new function included, you need pointer of that type to be declare in code. Wot about delegates..? Delegate usage prevents user to use GetProcAddress and require any function pointer to work with. It wraps all functions to which you want to call at run time. Thus we'll not need any function pointer or need to know the type for that pointer. Once we know the function Name,in/out params and their types, Without using GetProcAdress, we can call these functions using delegates. But for this we need to work in managed code sustains within C#.NET
|
Next
|
Last
Pages: 1 2 Prev: ImageList + extract image Next: calculating process size from map file |