<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV><FONT face=Arial size=2>I have a DLL which defines a structure for passing 
information 2 ways.</FONT></DIV>
<DIV><FONT face=Arial size=2>I need to define some functions and procedures that 
will be called from a 3rd party DLL that I'm loading.&nbsp; I've successfully 
loaded the DLL and can call the functions &amp; procedures in the DLL, but I'm 
not sure how to set up the reverse situation where the DLL requests information 
from my program.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Here is an example DLL&nbsp;structure and what I've 
done so far.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#000080 size=2>type</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; PSomeDLL = 
^TSomeDLL;</FONT></DIV><FONT color=#000080>&nbsp; TSomeDLL = 
record<BR>&nbsp;&nbsp;&nbsp; Init : procedure; cdecl;<BR>&nbsp;&nbsp;&nbsp; Quit 
: procedure; cdecl;<BR>&nbsp;&nbsp;&nbsp; GetNumber : 
function(FileName:PChar):Integer; cdecl;<BR>&nbsp; end;</FONT></FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; TDLLStruct = function: 
PSomeDLL; cdecl;<BR>....</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>var</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; DLLStruct: TDLLStruct;&nbsp; 
</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>begin</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; @DLLStruct 
:=&nbsp;GetProcAddress(...</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; DLLStruct.Init;</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This is working and I can&nbsp;successfully call 
DLLStruct.Init and DLLStruct.Quit from my program, but GetNumber is actually 
called by the DLL, so I need to supply the result of the function.&nbsp; How do 
I go about that?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I thought I would have to do something like 
this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#000080 size=2>type</FONT></DIV>
<DIV><FONT face=Arial size=2><FONT color=#000080>&nbsp; TGenNumber 
=&nbsp;function(FileName:PChar):Integer; cdecl;<BR></FONT></DIV></FONT>
<DIV><FONT face=Arial color=#000080 size=2>var</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; GetGenNumber: 
TGenNumber;</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>...</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>GetGenNumber := 
DLLStruct.GetNumber;</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>...</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>function 
GetGenNumber(FileName:PChar):Integer;</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>&nbsp; Result := 1; // 
something</FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2>end;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This compiles but the function GetGenNumber above 
is not compiled into my executable because it doesn't think it's being 
called.&nbsp;&nbsp;It isn't being called within my program,&nbsp;the DLL will be 
calling it, but the compiler doesn't know that.&nbsp; What as I 
missing?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Ross.</DIV></FONT></DIV></BODY></HTML>