Well if it is a DLL, then you will be able to reference the functions that
are declared within the dll, with a bit of code like :
var
localNewPlugIn : TPlugInDLLFunction;
begin
try
HInst := LoadLibrary(PChar(sDLLName));
if HInst > 0 then
begin
FPointer := GetProcAddress(Hinst, PChar('NewPlugIn'));
if FPointer <> nil then
begin
localNewPlugin := TPlugInDLLFunction(FPointer);
fPlugIn := localNewPlugIn;
end;
end;
finally
FreeLibrary(Hinst);
end;
This does it dynamically of course but there are other ways, if you know
the name of the dll you can bind it directly into the executable you are
making.
function LocalNewPlugin(S: string): string; external 'plugin.dll';
If the exe is a COM server, then you can import the type library and use
the interfaces that are provided. This is a large topic , so you may want
to do more reading.
If the exe is a plain old exe, then you call it externally via a call to
CreateProcess. Seeing as you have no code for the exe in hand, to my
knowledge there is no way you could compile a C binary into a Delphi exe.
Compilation requires source code, there are no ways around this.
There are numerous ways of creating plugin type modules if you are doing
both sides in Delphi. A project that I am working on currently, places
wizards in dll's and these are then called by a host executable. We assign
the handle of the wizard to the host executable and this makes the wizard
appear within the host (Delphi exe). This gives us a large deployemtn
advantage in that we don't need to redistribute the executeable when we
need to change a wizard, we simply send out a new dll.
Hope this helps
(Embedded
image moved [EMAIL PROTECTED]
to file: 21/07/2000 10:07
pic09772.pcx)
Please respond to [EMAIL PROTECTED]
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
cc:
Subject: [DUG]: How to make Plug-Ins?
All
Excuse me if this question looks simple and basic that not worth to
answer.
Suppose I got two programs already developed in standalone way, one is
developed in Delphi and other is developed in C with either .EXE or .DLL
extension, My purpose is to make program that is made in C a Plug-in then
integrate to program that is made in Delphi(host program, that means we
can
run the C code in Delphi code). The questions are:
1, Dose anyone know how and probably can we got some points to start with?
2, How Delphi compile different language together?
3. How to do it if we failed above, then we decide both code developed in
Delphi ?
4. For the interest of this user group discussions, if the host program is
not developed in Delphi and have no source code in the hand(like Microsoft
IE), is it possible making the code that is made in C or other languages
Plug-in?
Cheers
Brett
Paintbrush