Board index » delphi » DirectX & non-DirectX version in 1 exe file

DirectX & non-DirectX version in 1 exe file

Hello.  Is it possible to compile one .exe file that will take advantage of
DirectX routines while also able to run in normal mode (not use the DirectX
routines) if DirectX is not desired?  For example, if a user doesn't have
DirectX installed, I would like to have the .exe file just simply not use the
DirectX routines.  Instead, a user without DDraw.dll on their system will get
errors when trying to run the program even if they've specific not to use the
DirectX features.  

In short, the program is looking for the DDraw.dll files because some of the
routines in the .exe file are linked to it even though I may not be using
them.  Is there a way to not need the DDraw.dll files if DirectX isn't wanted?

Thanks for your time,
--
Steve Barber
Run Productions
http://users.multipro.com/runpro

 

Re:DirectX & non-DirectX version in 1 exe file


Quote
Steve Barber wrote:
> In short, the program is looking for the DDraw.dll files because some of the
> routines in the .exe file are linked to it even though I may not be using
> them.  Is there a way to not need the DDraw.dll files if DirectX isn't wanted?

I've never written a DirectX program but can you do something like this?
Found it in D3 Help index "static imports"

program ShowTime;
uses Windows;
type
 TTimeRec = record
   Second: Integer;
   Minute: Integer;
   Hour: Integer;
 end;
 TGetTime = procedure(var Time: TTimeRec);
var
 Time: TTimeRec;
 Handle: THandle;
 GetTime: TGetTime;
begin
 Handle := LoadLibrary('DATETIME.DLL');
 if Handle <> 0 then
 begin
   @GetTime := GetProcAddress(Handle, 'GetTime');
   if @GetTime <> nil then

   begin
     GetTime(Time);
     with Time do
       WriteLn('The time is ', Hour, ':', Minute, ':', Second);
   end;
   FreeLibrary(Handle);
 end;
end;

Other Threads