Hi,
Some months ago I wrote Jeff that I still have problem with
LabView's library to CA client. When LabView program finishes to work
with CA (=calls ca_context_destroy() ) I see that LabView crashed. When
I start from Visual C++ debug I see message
"First-chance exception in LabView.exe (NTDLL.DLL): 0xC0000005: Access
Violation."
In that case it was difficult to catch bug. It could be in
LabView, in library, in Epics CA. Moreover, other simple tests work
fine.
Some days ago I noticed difference between LabView call and
simple test programs. My simple test programs call ca.dll in "Implicit
dynamic linking". LabView calls any dll in "Explicit dynamic linking".
I wrote the simplest program
============================
#include <windows.h>
#include "cadef.h"
HINSTANCE hLibrary;
char * AcPVName = "DTL_Diag:ND334:FaLoss1";
chid chidChannelToPV;
typedef int ( __stdcall * iFca_context_create)( enum);
iFca_context_create piFca_context_create;
//epicsShareFunc int epicsShareAPI ca_create_channel( const char
*pChanName,
// caCh *pConnStateCallback, void *pUserPrivate, capri
priority, chid *pChanID);
typedef int ( __stdcall * iFca_create_channel)( const char *, caCh *,
void *, capri, chid *);
iFca_create_channel piFca_create_channel;
//epicsShareFunc int epicsShareAPI ca_pend_io( ca_real timeOut);
typedef int ( __stdcall * iFca_pend_io)( ca_real timeOut);
iFca_pend_io piFca_pend_io;
//epicsShareFunc int epicsShareAPI ca_clear_channel( chid chanId);
typedef int ( __stdcall * iFca_clear_channel)( chid chanId);
iFca_clear_channel piFca_clear_channel;
typedef int ( __stdcall * iFca_context_destroy)( void);
iFca_context_destroy piFca_context_destroy;
typedef int ( __stdcall * iFca_context_destroy)( void);
iFca_context_destroy piFca_context_destroy;
int main(){
long lStatus;
hLibrary = LoadLibrary("C:\\Epics\\bin\\win32-x86\\ca.dll");
piFca_context_create = ( iFca_context_create) GetProcAddress(
hLibrary, "_ca_context_create@4");
if( piFca_context_create != NULL)
lStatus = ( ( piFca_context_create)(
ca_enable_preemptive_callback));
// piFca_create_channel = ( iFca_create_channel) GetProcAddress(
hLibrary, "_ca_create_channel@20");
// if( piFca_create_channel != NULL)
// lStatus = ( ( piFca_create_channel)( AcPVName, 0, 0, 0,
&chidChannelToPV));
// piFca_pend_io = ( iFca_pend_io) GetProcAddress( hLibrary,
"_ca_pend_io@8");
// if( piFca_pend_io != NULL)
// lStatus = ( ( piFca_pend_io)( 10));
// piFca_clear_channel = ( iFca_clear_channel) GetProcAddress(
hLibrary, "_ca_pend_io@4");
// if( piFca_clear_channel != NULL)
// lStatus = ( ( piFca_clear_channel)( chidChannelToPV));
piFca_context_destroy = ( iFca_context_destroy) GetProcAddress(
hLibrary, "_ca_context_destroy@0");
if( piFca_context_destroy != NULL)
lStatus = ( ( piFca_context_destroy)());
lStatus = FreeLibrary( hLibrary);
return 1;
}
=====================
This is output from the program. It has
First-chance exception in EpicsToLabViewTest.exe (NTDLL.DLL):
0xC0000005: Access Violation.
=================
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic
information found.
Loaded symbols for 'C:\Epics\bin\win32-x86\ca.dll'
Loaded symbols for 'C:\Epics\bin\win32-x86\Com.dll'
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information
found.
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded symbols for 'C:\WINDOWS\system32\MSVCP60D.DLL'
Loaded 'C:\WINDOWS\system32\mswsock.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\wshtcpip.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\dnsapi.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\winrnr.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\wldap32.dll', no matching symbolic
information found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic
information found.
The thread 0xA30 has exited with code 1 (0x1).
First-chance exception in EpicsToLabViewTest.exe (NTDLL.DLL):
0xC0000005: Access Violation.
The thread 0xF34 has exited with code 1 (0x1).
The thread 0xA0C has exited with code 1 (0x1).
The thread 0x930 has exited with code 1 (0x1).
The thread 0xFD8 has exited with code 1 (0x1).
The program
'C:\EpicsClients\EpicsToLabViewTest\Debug\EpicsToLabViewTest.exe' has
exited with code 1 (0x1).
=================
Couple moments.
1. I use Epics 3.14.4. Visual C++ 6.0. Of course, Window XP.
2. Epics dll are compiled with __stdcall. I couldn't call Epics function
until
- adding __stdcall to each "typedef int ( __stdcall *
iFca_context_create)( enum);"
- changing function name to name in real dll like
ca_context_create to _ca_context_create@4. For example,
piFca_context_create = ( iFca_context_create) GetProcAddress(
hLibrary, "_ca_context_create@4");
Maybe anybody know how it can be used in normal way?
Thanks, Andrei.
- Replies:
- RE: explicit dynamic linking and ca.dll . CA bug? Jeff Hill
- Navigate by Date:
- Prev:
RE: 3.13 to 3.14 issue Mark Rivers
- Next:
Need direction in getting asyndriver build. Iris Allard
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: 3.13 to 3.14 issue Mark Rivers
- Next:
RE: explicit dynamic linking and ca.dll . CA bug? Jeff Hill
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|