Just to be clear, I'd like general answers for machine code, since that's the hardest case and solving that will solve any other alternative (so as not to ask in the future, and for others finding this thread).
In reality, I am compiling to c++ and letting the c++ compiler generate the code to load dlls for the time being.
Oh, and I know what a compiler is, and yes, I realize that I'm currently making a translator and not a compiler. I'm not making a runtime interpreter.
Yes, I get that part -the problem is the execution, very specifically, how to use a specific function, for example:
In windows, to set the position of a window via instructions, you need to use "SetWindowPos", inside WinUser.h.
I -obviously- wouldn't be able to include that file, since it's written in c++.
This means that I would have to implement my own way of calling them.
I understand your proposal of making, basically, the equivalent of the c++ standard for this. I think it's a great idea -however I wanted a more general way to call ANY function.
So to sum up the issue -I need a way to call "SetWindowPos" without including any c++ file, even if it is in c++. I do not know how to do that.
I've looked into the file itself and found that the expression expands to:
1 2 3 4
|
__declspec(dllimport)
int
__stdcall
SetWindowPos(_In_ HWND hWnd, _In_opt_ HWND hWndInsertAfter, _In_ int X, _In_ int Y, _In_ int cx, _In_ int cy, _In_ UINT uFlags);
|
What does that code do? I'm assuming it's a function declaration that won't be resolved until runtime, when the dll file is loaded. Is this right?
Is there no need to specify the specific .dll file to load?
Would this work the same if this was a third party dll? If not, how would I be able to a function in it?
Would it work the same with libraries in other (compatible) languages?