PDA

View Full Version : IC_InitLibrary crash



bartaandras
October 12, 2014, 19:25:30
Hi,

I am trying to use the C version of the library. I downloaded and installed it, and within my program I called IC_InitLibrary(0). At this step the program crashes. I copied all the x64 dlls to the folder of the executable (TIS_DShowLib10_x64.dll, TIS_UDSHL10_x64.dll, tisgrabber_x64.dll and tisgrabber_x64.lib).

I build my application with MinGW 64 on Windows 7 64bit. I have read in forum threads, that people were successful using the library with MinGW, although with the 32 bit version. I do not have any idea, what can be the problem. In one thread (http://www.theimagingsourceforums.com/showthread.php?322139-IC_InitLibrary()-from-the-wrapper-dll-keeps-on-crashing) I read that copying ICFilterContainer.dll to the applications folder solved the crash, but I do not have that dll after installation of the library.

I appreciate any help.

Thanks, Andras

Stefan Geissler
October 13, 2014, 08:58:11
Hello

do you receive any other message than "crash"?

bartaandras
October 13, 2014, 11:41:20
No, there is nothing else. The usual windows crash dialog appears.

I already checked my executable with dependency walker, and it did not find any other required libraries that should be there near the executable.

I also tried to catch std::exception that may be thrown by the function, but it simply crashed without exceptions.

I turned virus scanner off. I do not know, what could I do.

This is my minimal test application, that crashes:


#include <iostream>
#include "tisgrabber.h"

int main()
{
int ret = IC_InitLibrary(0);
std::cout << ret << std::endl;
return 0;
}


How could I step forward?

Andras

Stefan Geissler
October 13, 2014, 11:56:03
Hello

Is there anything in the Windows Eventlog?
Which Windows version do you use?
Is it an embedded Windows?

bartaandras
October 13, 2014, 12:11:00
It is a WIN7 home premium 64bit. Not embedded.

Yes, there is an error in event viewer, here is a screenshot:
1729
The details:
1730
And the next information log:
1731

Thanks, Andras

Stefan Geissler
October 13, 2014, 13:56:43
Hi

Errox 0xC000..05 points to an access violation.

I suppose, you can not run the "ansi.c" sample code too, right?

What happens, if you compile as 32bit?

bartaandras
October 13, 2014, 15:45:03
I had to make a few modifications to ansi.c to compile it, but the end result is the same crash.

I also tried to compile it in 32 bit mode. This time it crashed again but with a different dialog, that said "The application was unable to start correctly (0xc000007b)."

Do you know what does this error code mean?

Thanks, Andras

bartaandras
October 13, 2014, 18:17:29
A small step forward.

I tried to run ansi.c directly from the IDE, and finally it did not crash, so the last error (0xc000007b) was caused by the improper environment setup (I tried from the command line previously). However it presented a dialog with "InitLibrary failed", although the argument of IC_InitLibrary was 0. (Also this was compiled in 32bit mode, while at the end I will need to have it compiled in 64bit.)

Andras

Hansi
October 14, 2014, 10:17:06
Hello,

my application runs together with the libraries from opencv (incl. TBB) and with posix threads, compiled with mingw32 for 2 years.
Last week I got an update of all includes libraries.
I Compiled both versions, a 32 bit as well as a 64 bit version
The 64 bit version was the first time I did and only neccessary because migration to Win 7 64 bit.
The 32 bit version runs smoothly. At the 64bit version I got the initialization error (Segmentation fault) of the tisgrabber.
I analysed the executable with "dependancy walker" but it told me everything is ok as well as the compiler and linker
gave no more relevant warnings or errors.
More information'm not getting unfortunately.

It seems there is anything wrong in the 64bit tis-dll's.
I also tried an older version of the tis-dll's but I got the same error.


My test environment:
all current libraries and compiler on Win7 64bit.

Regards
Hans

Stefan Geissler
October 14, 2014, 11:37:06
Hans

A first comment:

because migration to Win 7 64 bit.
In Windows 7 64bit you can run 32 bit applications too. No need to build 64 bit applications, except your program needs to allocate more than 4GB of memory.

Regarding the IC_Initlibrary error:
Outch. I have the same error in 64 bit now. ... start debugging now.

Hansi
October 14, 2014, 12:02:17
Hans

A first comment:

In Windows 7 64bit you can run 32 bit applications too. No need to build 64 bit applications, except your program needs to allocate more than 4GB of memory.

Regarding the IC_Initlibrary error:
Outch. I have the same error in 64 bit now. ... start debugging now.


I know that win7 64bit supports 32bin but I need more than 4GB mem for an other application and I'd like to use the same IDE-environment (64bit compiler) for both solutions.

Good luck for debugging!

Hans

Stefan Geissler
October 14, 2014, 12:27:23
Finally found it. It was a wrong handled return value in the library.

Attached you find the DLL and lib file zipped. The setup is too big as attachment here.
Overwrite your DLLs and Lib with the new files.

I am very sorry for the error in the library.

bartaandras
October 14, 2014, 13:08:09
Thanks for the repair. However it still crashes for me generating the same 0xc0000005 error in the event viewer. The same behaviour in my own application as well as in ansi.c.

What other information should I provide?

Thanks, Andras

Stefan Geissler
October 14, 2014, 13:28:59
The complete setup for version 3.3.0.10 is now available at http://www.theimagingsource.com/en_US/support/downloads/details/tisgrabberdll/


Thanks for the repair. However it still crashes for me generating the same 0xc0000005 error in the event viewer. The same behaviour in my own application as well as in ansi.c.

Please check 32bit build too.

bartaandras
October 14, 2014, 14:23:55
I installed version 3.3.0.10. Compiling ansi.c in 32 bit mode now works, my camera shows picture, that is perfect.

However in 64 bit mode there is the same crash with the same event log.

Andras

Stefan Geissler
October 14, 2014, 14:28:31
Hello Andras.

I must admit, I am lost. I tested on my computer and it is working as 64bit version as expected.

bartaandras
October 14, 2014, 14:32:13
What is your build environment? Do you use MinGW W64 as well? I had to add gdi32.dll to the link command to link properly, but there is no gdi64.dll. Is it OK? How could I create a stack trace or something that might help you to figure out, what causes the crash?

Thanks for your effort, Andras

Hansi
October 14, 2014, 17:32:49
Hello Stefan,

I have to confirm what bartaandras already has been found.
The new library 3.3.0.10 does not work as a 64-bit but as a 32-bit version.
I have now compiled,linked and tested several libraries from different manufacturers
with mingw 64 (x86_64-4.9.1-release-posix-seh-rt_v3-rev1)
but only the TIS-grabber leads to a crash.
So I'm assuming that the actual TIS library has a bug.

Can I maybe provide anything yet, so that the error is reproducable or fixable for you?
As I said, "dependency walker" says that all libraries(DLL's) are available as a 64 bit version.

I compiled the example program ANSIC.c and get the same error in the 64bit version.
The 32 bit version works!

Hans

Stefan Geissler
October 14, 2014, 17:49:03
Hmm ... works fine on my machine. I am puzzled.

can you please check the file versions of
tisgrabber_x64.dll expected 3.3.0.10
TIS_UDSHL10_x64.dll expected 3.3.0.1963
TIS_DShowLib10_x64.dll expected 3.3.0.1963
?

bartaandras
October 14, 2014, 17:58:34
I checked them, and found the same version numbers as expected.

Andras

Hansi
October 14, 2014, 18:37:20
The same with me, the version numbers are identical!

Hans

Hansi
October 14, 2014, 19:42:29
Hello Stefan, hello Andras,

now I checked some mingw forum items and found a solution:

The problem:
GCC/ld can link to (properly exporting) 32-bit DLLs and .lib/.a import and static libraries.
GCC/ld should be able to link to a properly exporting 64-bit DLL or .a import or static lib, but never a 64-bit .lib file.

Now I describe the way to get a working library:
1. Create a def file with gendef which is part of mingw-64:
gendef tisgrabber_x64.dll
This call creates a new file: tisgrabber_x64.def
2. Create a .a library with dlltool witch is also part of mingw-64
dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libtisgrabber_x64.a --input-def tisgrabber_x64.def
This call creates a new file: tisgrabber_x64.a

Now you can include the new .a-library in your project!

Maybe the tisgrabber_x64.a file is soon part of the library from tis.

Regards
Hans

bartaandras
October 14, 2014, 21:27:50
And it indeed works! Nice solution, Hans!

Thanks for both of you for your help!

Best regards,
Andras

Stefan Geissler
October 15, 2014, 08:56:08
Hans,

I am impressed!

The tisgrabber.lib in the x64 path is the output of the 64bit build. The lib in the win32 path is the output of the 32 bit build. I am not sure about the differences in the libs.

Maybe it is time to think a c file with "getprocaddress()" calls.... instead of using a lib.

Hansi
October 15, 2014, 10:15:10
Hello Stefan,

the provided dll's are indeed sufficient.

I was at first unknown that the gcc-linker is not used 64bit .lib files.
Everybody would expect that the linker reject this kind of libs but it doesn't (error of mingw).

If you create tisgrabber_x64.dll with gcc,
you can probably add the parameter "--out-implib libtisgrabber_x64.a" to create a .a file additionally.

Then I think the library would be complete also for x64.

Hans

Stefan Geissler
October 15, 2014, 11:43:41
Hello Hans,

I can not create the DLL with GCC, because it uses the TIS_UDSHL.DLL which exports memory. This leads to trouble, if use do not use an MS compiler.
However, the library is intended to be a standard C DLL. All programs should be able to link to the DLL, regardless, which compiler was used.
I suppose, if not the lib file, but a C file with "getProcadress()" for each function was used, then this issue did not have happen.