Article View: borland.public.cppbuilder.nativeapi
Article #740Re: DLL and currency issues
From: dhoke
Date: Tue, 22 Jan 2008 15:56
Date: Tue, 22 Jan 2008 15:56
59 lines
2739 bytes
2739 bytes
An access violation occurs where?
Doesn't look like it would happen in the code you presented, unless you have
the same appl accessing that routine, and some of the items passed in via
pointer are being freed underneath one of the invocations by a thread that
used a different invocation...
"Colin B Maharaj" <noreply@myhost.com> wrote in message
news:4795f94a$1@newsgroups.borland.com...
> Hi all, I wrote this sorting DLL years ago
> works fine and all. However recently I started
> using the DLL more than once at a time, via
> the current win user and a web user.
>
> This is a sorting DLL.
> However whenever, the web or win user process
> start and concurrency begins, and ends an access
> violation ensues.
>
> Here is the DLL wrapper code
>
>
>
> //---------------------------------------------------------------------------
> // The procID and Sequence number are to make
> // unique temporary file sets in the DLL
> // so file names would not collide in the sorting
> // process.
> //---------------------------------------------------------------------------
>
> typedef void (__stdcall *lpSortWrapperDLL)(char *, int, int, char *, char
> *);
>
>
> void SortWithDLL(char *cmdline, int procID, int SeqNo, char *InF, char
> *OutF)
> {
> HINSTANCE lpDLL = LoadLibrary("CTSORT.DLL");
> lpSortWrapperDLL SortWrapperDLL=NULL;
>
> if (lpDLL)
> {
> SortWrapperDLL = (lpSortWrapperDLL) GetProcAddress(lpDLL,
> "SortWrapperDLL");
> if (SortWrapperDLL) SortWrapperDLL(cmdline, procID, SeqNo, InF,
> OutF);
>
> if (!SortWrapperDLL)
> {
> ErrorMessage("Function not found in DLL!");
> }
>
> FreeLibrary(lpDLL);
> }
> else
> {
> ErrorMessage("CTSORT.DLL is needed.");
> }
> }
Technical Details
Message-ID:
<4796122d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4795f94a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ab05be4dbc268be X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "dhoke" <dhoke.nojunk@east-shore.com> From: "dhoke" <dhoke.nojunk@east-shore.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4795f94a$1@newsgroups.borland.com> Subject: Re: DLL and currency issues Date: Tue, 22 Jan 2008 10:56:18 -0500 Lines: 61 Organization: East Shore Technologies, Inc. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 72.92.186.89 Message-ID: <4796122d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1201017389 72.92.186.89 (22 Jan 2008 07:56:29 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail