Recommendation for a dll compiler for exeoutput for php

Hi, I know this is probably outside the normal discussion here, but was wondering if someone could give a novice (haven’t programmed in C/C++ since about 2005) C++ programmer some recommendations on a compiler (ideally opensource) for compiling dlls for exeoutput for php to use (not as php extensions) - this in specifically in relation to my earlier thread on obtaining network card ip addresses. I have read these articles here http://tangentsoft.net/wskfaq/examples/ipaddr.html and http://tangentsoft.net/wskfaq/examples/ipaddr.html to access windows dlls, but not sure how to implement them in hescript, so was thinking about trying to write a small .dll which just returns the current main network card ip address with no parameter calls, and the dll itself does the calling of wsock or GetAdaptersAddresses via example code - but as I haven’t done C++ in ages, was wondering on recommendations for a compiler. Ideally want opensource as I don’t want to have to spend a fortune just for possibly one small task.

Alternatively as hescript can call some Delphi Pascal functions, were there any Delphi Pascal functions which would return the network card address I could use in hescript ?

I do have a solution by my application program calling ipconfig program on windows 7 via hescript, but if microsoft ever change the formatting of their program then it will no longer work. Also from purely cosmestic reasons I don’t like the way in my existing program a command dos box temporary appears when the ipconfig program is run (hiding status in Runprogram doesn’t hide the box alas).

Thanks.

Got my dll close to working, but only if it is outside the application in the same path - ideally if possible want the dll compiled into the application. Is that possible ? However also seems to be a limitation on HEscript and functions - it cannot seem to return unsigned long integers ?

Thanks…

Yes, it should be possible to compile your DLL in the application.

UnpackVirtualResource will be helpful (from http://www.exeoutput.com/help/scriptreference)

function UnpackVirtualResource(const SourceName: String; const DestFile: String): String;

Extracts a file from the application’s data (it must have been
compiled) to the virtual memory storage and returns the path to this
file. The file only exists in memory: it is not on the hard disk.
Nevertheless, it works as if it were on the hard disk at the
specified path.

I suggest that you unpack the DLL at application startup with UnpackVirtualResource, using one of the initialization events in UserMain.
And place DLL declarations in another HEScript than UserMain. The script should be invoked only after the DLL has been virtually unpacked and made available.

Thanks for the reply and suggestion, but having problems trying to implement it.

I have set UnpackVirtualResource(“ipaddress-dll.dll”) to unpack the .dll and return the virtual path, but please how do I then use that virtual path in the dll function declaration…

eg function HardwareIP: Cardinal; external “ipaddress-dll.dll” name ‘CardAddress’;

Cannot work out how to replace “ipaddress-dll.dll” with a string reference to an external startup procedure which gets the unpacked .dll’s full path.

Thanks again for your help.

That’s why you should set the virtual path to the same folder as the .EXE file, so that you don’t have to specify any full path in the function declaration. Windows will automatically look in the same folder as the .EXE file when loading additional DLL files. To get the path to this folder, check global variables in ExeOutput documentation or our general demo.

Thanks, but unfortunately just cannot get it to work. The hescript is not seeing the .dll I have the .dll in the same folder / path as the main index.php, set to be virtualised… But when I run the application, it isn’t seeing the .dll.

I will try setting the 2nd argument of UnpackVirtualResource(“ipaddress-dll.dll”) to the path of the .exe, maybe that will work ?

Solved it, and below is the hescript code I used.

UserMain:

function OnPubLoaded: Boolean;
var
 DLLPath: String;
begin
 // When the application is starting.
 // Set Result to True if you want to exit immediately without any warning. 
DLLPath := GetGlobalVar("HEPublicationPath", "");
UnpackVirtualResource("ipaddress-dll.dll",DLLPath + "ipaddress-dll.dll");
Result := False;
end;

then as before in Macros:

function CardAddress: Cardinal; external "ipaddress-dll.dll";

function TestDLL(void): Cardinal;                           
begin                                 
Result := CardAddress(); 
end;     

The dll ipaddress-dll.dll loaded into same path as index.php home script.

Congratulations, it looks very good!