Re: Call DLL without knowing arguments

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



1. You can't, unless it's a C++ function not marked with extern "C" to hide
the C++ name mangling. If it's a C function, there is no way, other than
knowing ahead of time, what the parameters are supposed to be.

2. __asm can be used *for some processors*. If my recollection is correct,
it works for x86, but not for any of the others.

To use a .s file (for ARM, anyway), just use it as you would a .c file, but
write it in the assembly language of the target processor.

Paul T.

"Filipe Madureira" <FilipeMadureira@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:9F455861-5908-44A2-9537-4D13ED3D1D93@xxxxxxxxxxxxxxxx
Hi,

I have 2 questions that are related:

I need to allow the user of my application to run a function from any DLL
he
wants.

The problem is the "variable and unknown argument list".

Question 1:
How can I call a DLL function filling in the arguments by code?
The only solution I found so far is to use assembly code. Anyone knows of
an
alternative?

Question 2:
In PC I can use the __asm directive to add assembly code.
So I just do "push" for the arguments, and then "call" the function
address
I got with "GetProcAddress".

But eVC says: "nonstandard extension used : '__asm' keyword not supported
in
this product"

I read that I can use the assembly code in a .s file. But I did not find
any
documentation on how to use .s file code in C++ code or how to link it.
How do I use a .s file?

Thanks


.



Relevant Pages

  • Re: Call DLL without knowing arguments
    ... I did not understand how to add to .s file code to my cpp file. ... char c='x'; ... The commented lines are the assembly code I wanted to include with the __asm ... How can I call a DLL function filling in the arguments by code? ...
    (microsoft.public.windowsce.embedded.vc)
  • Call DLL without knowing arguments
    ... How can I call a DLL function filling in the arguments by code? ... The only solution I found so far is to use assembly code. ... documentation on how to use .s file code in C++ code or how to link it. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: determining return address of a function
    ... Enrique Perez-Terron wrote: ... > The assembly code of the call of test1may possibly contain some register ... > shuffling and stack operations after the call. ... what are the possible uses of knowing the return ...
    (comp.os.linux.development.system)
  • Re: Bug in MFC CList?
    ... I mean, in assembly code. ... I normally use malloc/freeor new/delete, knowing that it is the less expensive way. ... It is never necessary to use newfor local variables if you have fixed sizes. ...
    (microsoft.public.vc.mfc)