473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to call a function dynamically from a DLL?

Hi All,

I have a scenario where a windows application tries to load a 3rd party DLL and call any functions defined in that DLL.

How to call a function dynamically from a DLL

There are certain restrictions implied to this implementation, which includes:

1) Return values should be an int
2) Only primitive datatypes can be used as function parameters.

The 32-bit version of the application have this implemented with the help of inline-assemblies. Now I'm to porting this to 64-bit and have a restriction of using inline-assemblies.

So I have a scenario where I need to re-write this implementation and having trouble in identifying the signature of the function and the type of the function parameters dynamically.

Note: The existing logic is like this:

- the requested function name to call is already passed along with the values
- Loads any dll using loadLibrary()
- Get the requested function name address using getProcAddress
- Based on the count of function arguments, each argument is checked for its type and then is pushed into a custom Stack ( using Inline assemblies __asm)
- Once all the function arguments are pushed, the function pointer address is called using Inline again (call address) and everything works fine.

- now with my case, I'm able to push arguments in my own stack, but not how to pop it(because not sure about the type of the argument).

If any one had done implementations similar to this, please share your knowledge. Ur reply will be highly appreciated.

Also please let me know for any questions (i know my writing is messy )

Thanks in Advance,
Manesh S
Oct 1 '10 #1
0 1223

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joe | last post by:
I have 3 functions: ClientInfoA is doing something ClientInfoB is doing something SelectFunction2Run is a function to determine which function needed to run based on the value of the variable...
5
by: Lucy Randles | last post by:
I've written a VBA function that I then need to call in a form. Previously to do this I have written the call procedure in the same module as the function - i.e. Function callfunctionname() Call...
1
by: Mansi | last post by:
Let's say I have the following class: class ccTestClass { public void doMethod() { } } If I have the name of the method stored in some variable x, such that String
2
by: PawelR | last post by:
Hello Group, In my application I have few class, and I want call function with "master class". This is as master form (startClass) and option window (ClassA). My question is how call function...
4
by: Dave | last post by:
I have a program that I've written a class for. I need to call the function in the program from the class. When I try to call the function I receive the error, the name xxx does not exist in the...
2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
7
by: Tiraman | last post by:
Hi , I have 3 files , middle.aspx file include the header.aspx and footer.aspx files . in each of the include files there is a function and from some reason the call to the Footer() function...
12
by: leaf | last post by:
Hi, How to call function at runtime, based on a struct that contains the information for the function call: struct func_to_call { int function_id; // function id to call unsigned int nparams;...
5
by: gaya3 | last post by:
Hi All, How do i call the javascript function dynamically from another javascript function? Example: <script> function getStructure(attrName) { //attrName is dynamic one... for example...
1
by: zeeshan708 | last post by:
lets suppose that we have a C++ standard string object S. and we have const char * S2. when we do S2=S.data(); then what happens? does this function dynamically allocates space to S2 and writes...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...

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.