|
|
|
date: Fri, 29 Feb 2008 02:07:01 -0800,
group: microsoft.public.dotnet.languages.vc.libraries
back
Re: Calling freelibrary problem
SvenC,
I have called the freelibrary after loadlibrary, the system return the error
message too.
I use the data conversion function CA2W(avr309dll) in the loadlibrary. I 'm
not sure it's correct or not, but the function can be called. And after the
function is finished, error will occurs.
I find the header file from internet, the orginal source code doesn't
include the header file. I have try it in visual basic, it's worked.
And I find that after I run the loadlibrary, the system windows in the
bottom of the screen show the avr309.dll with the symbol "!". Does it mean
that the dll is not loaded correctly?
Thank you,
Ricky
"SvenC" wrote:
> Hi Ricky,
>
> > DLLInstance = LoadLibrary(CA2W(AVR309DLL)))
> >
> > DoSetDataPortDirection = (IMPFUNC_U) GetProcAddress (DLLInstance,
> > "DoSetDataPortDirection");
> >
> > I can call the function correctly by using loadlibrary() and
> > getproaddress() command. But when I call freelibrary(), the system
> > return the error message
> > "First-chance exception at 0x77fa167c in URC_App.exe: 0xC0000008: An
> > invalid handle was specified."
> > I have tried to use afxloadlibrary and afxfreelibrary, but the
> > problem still occurs.
>
> What happens when you call FreeLibrary directly without ever
> calling DoSetDataPortDirection?
>
> Are you sure that you use the correct calling convention and
> parameters when you call that function? Did you get a header
> from the dll manufacturer or do you build the dll yourself?
>
> It might be a bug in the dll as well. When the last FreeLibrary
> is called DllMain of that dll is called.
>
> --
> SvenC
date: Fri, 29 Feb 2008 08:22:00 -0800
author: Ricky Chong
|
|