My Allegro.pas wrapper includes a nice complete platform game. It's very simple and I think very documented. Also I plan to release an almost beta version.Originally Posted by marcov
My Allegro.pas wrapper includes a nice complete platform game. It's very simple and I think very documented. Also I plan to release an almost beta version.Originally Posted by marcov
No signature provided yet.
I can dispell the doubt because I've written an application that does it. It's a fractal renderer I wrote many years ago and it stored it's equations in a DLL that is loaded dynamically at run time.Originally Posted by Brainer
The way it works is you load a library with loadLibrary and then rather than have the compiler sort the dependencies etc. out at compile time, you use a mechanism similar to event handlers to sort them out yourself. You get the addresses of the calls using getProcAddress (IIRC).
For example (taken from my Fractal program), here is a prototype definition:-
[pascal]
TEQPConfigEQ = procedure( CurrentEQ:Integer;
var xmin:TFloaty;
var xmax:TFloaty;
var ymin:TFloaty;
var ymax:TFloaty;
var arg1:TFloaty;
var arg2:TFloaty;
var arg3:TFloaty;
var arg4:TFloaty;
var arg5:TFloaty;
var arg6:TFloaty;
var arg7:TFloaty;
var arg8:TFloaty ); stdcall;
[/pascal]
In your main code you declare a variable like this...
[pascal]
EQPConfigEQ : TEQPConfigEQ;
[/pascal]
And initialise it using getProcAddress something like this...
[pascal]
@EQPConfigEq:=GetProcAddress(EQPLibraryHandle,'EQP lug_ConfigEq');
[/pascal]
If this fails, I think (IIRC) EQPConfigEQ ends up equal to NIL. If it succeeds, you call the routines just like a normal procedure called 'EQPConfigEQ'.
:: AthenaOfDelphi :: My Blog :: My Software ::
Thank you very much, Athena.
I should perhaps also add an example that is closer to home... if anyone uses the DGL OpenGL interface, that uses a similar mechanism to load the OpenGL DLL on the host machine.
:: AthenaOfDelphi :: My Blog :: My Software ::
Personally I would not use some DLL extraction technique. It is going to bring you into more problems with antivirusses, and the constantly increasing limitations of doing with binaries that use code.
If you really want to pursue this, go the way of static linking, but be warned, that takes work and skill.
Of course I wouldn't even try to do this, and just distribute DLLs. The one .EXE thing is fun from a purist stance, but there are many practical problems. The biggest being that if you finally figured it out, an year later, versions have changed and to upgrade you will have to do it all over again.
In other words, it is not an one way effort, but something that needs to be repeated as new versions, antivirruses, general security limitations in Windows etc mature.
Bookmarks