This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

More DLL fun! [fwd: ]


Howdy again

We're continuing our DLL battles here and here is another 
question that has come up.. If anyone can help me out with 
an answer here, I'd sure appreciate it.

Mark Thompson wrote:
> 
> I am trying to compare 2 pointers to functions.
> All I am looking for is if they match or not.
> The pointers are to a function.
> The function is in a DLL, and the first place to get the
> function pointer is in an exe.
> The following is kind of a code sample (kind of but not really).
> 
> In the exe.
> Pass a function pointer to DllFunc1.
> 
> DllFunc1( DllFunc1 );
> 
> In The DLL
> 
> Void DllFunc1( FuncPtr func )
> {
>  . Do some processing
>  if ( func != DllFunc1 )
>   func( func ) ;
> }
> 
> I know the above is a bad example,
> but it will work for demonstration.
> The passed parameter is not a pointer to the function DllFunc1,
> Instead what we get is a pointer to the DLL relocation table.
> This means that the comparison always fails.
> If func is set to DllFunc, it continually calls itself ending up in
> blowing the stack.
> If we link this application statically, the comparison works
> correctly.
> 
> Is there some way to make the comparison of  function pointers that
> are in a
> DLL actually compare the address of the function and not the address
> of the
> relocation table?


Thanks in advance for any suggestions

----------------------------------------
Robert Bresner          rbresner@olf.com
Open Link Financial    516-227-6600 x216
http://www.olf.com/    fax: 516-227-1799
----------------------------------------
Opinions expressed are explicitly my own
"No more talking!  Cerebus has a SWORD!"

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]