> I like the JUST wrap it up - never having done that before.
> So if what you are saying is as I read it - I know where the 
> problems in the C code are occuring and having done a bit of C in my
time I 
> could sort it out. Now with this altered C source, can I JUST create a
DLL 
> from it which will work?

If you can make a working .EXE from the C source (I presume you have
access to a C++ compiler) then it is pretty easy.  What I tend to do is
try and keep the interface between the C code & Delphi pretty simple by
writing a couple of new functions in C that form an object like
interface to the DLL.  

Once you have some functions in C then compile to a DLL (remember a DLL
is just a .EXE and write some matching functions on the Delphi side -
ie:

// delphi wrapper
function MyCFunction
   (Buf : PChar; DLen : WORD ): WORD; external 'MyDll.DLL'; stdcall;

function DoSomeProcessing(Buffer : PChar; DLen : WORD ): WORD;
begin
  result := MyCFunction( @(Buffer[3]), 1024 );
end;


// C DLL
UINT _export PASCAL MyCFunction( char *Buffer, UINT DLen )
{
   ...
   return uCRC;
}
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to