delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/07/15/14:00:39

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <378E09F3.65A0311@olf.com>
Date: Thu, 15 Jul 1999 12:18:59 -0400
From: "Robert Bresner" <rbresner AT olf DOT com>
X-Mailer: Mozilla 4.51 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin <cygwin AT sourceware DOT cygnus DOT com>
Subject: 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 AT olf DOT 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019