🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5966

Re: Link VC++ DLL

#5966
From: Dennis Jones
Date: Wed, 22 Jun 2005 18:40
29 lines
2247 bytes
"KL Chin" <klchin@1asia.com.my> wrote in message
news:42b90da0@newsgroups.borland.com...
> Hi,
>
> I used 3rd party VC++ DLL, everything were working fine with my
> program. Until when the 3rd party DLL had an update with extra
> funtion, after going throught the debugging/tracing, I found that the
static
> call/jump to the DLL function was wrong address, instead of
> call at Function_Init it call at Function_New.
>
> How to overcome this problem, I know re-import lib from the DLL,
> but this could not solve the future dll.

If the DLL adds or deletes functions, it is very likely that the function
addresses will change, so you are almost always better off re-creating the
import library if the DLL changes.  On the other hand, if the DLL only
changes the behavior of existing functions, chances are good that the
function addresses will not change (I believe the function addresses will be
independent of function size in the DLL, but I am not 100% sure about that).

The only way to guarantee never having to re-create the import library is to
not use an import library at all.  Instead of implicitly loading the DLL,
explicitly load it with LoadLibrary() and use GetProcAddress() to locate the
functions in the DLL.  If you do that, you will never have to worry about
the function addresses, but it is a bit more work.

- Dennis
Technical Details
Message-ID: <42b9b096$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42b90da0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c5261850dbffcc03
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42b90da0@newsgroups.borland.com>
Subject: Re: Link VC++ DLL 
Date: Wed, 22 Jun 2005 11:40:23 -0700
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 204.200.27.7
Message-ID: <42b9b096$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1119465622 204.200.27.7 (22 Jun 2005 11:40:22 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail