|
From: Pedro A. <ped...@po...> - 2006-09-22 16:32:37
|
Hywel B. Richards escreveu: > Hello All, > > I have spent quite some time recently trying to get a cegcc-compiled dll > to work nicely with a microsoft-compiled exe. I thought I could at least > share my experience, and hopefully get some tips on what I should be doing. > > Preparing the DLL was pretty straightforward (respect to the cegcc team, > this was much harder/impossible with earlier versions of gnuwince). > I used lib.exe from the microsoft stuff to create an import library, and > linked this during the microsoft compile, and everything worked fine. > > What I couldn't understand was that some of my API functions seemed to > work fine, but others seemed to just lock up the device (well, sometimes > you could just manage to kill the offending process, but it was as if my > program was now using all the CPU). After some investigation, this > seemed to happen only for API functions which tried to access the > filesystem. > > If I ran the program in debug mode from visual studio 2005, I could see > the trace messages from newlib warning that stdio was not initialized. > Looking through this mailing list, this problem seemed quite closely > related to problems other people have been getting. > > My workaround was to add a call to _initstdio() in a special init > function in my DLL that I call before I make any other calls to the DLL. > Now everything seems to work OK. > > To be safe, you should call (untested): __init_c__(); /* and then */ __initstdio(); > Can someone tell me if that is a reasonable workaround? Also, am I right > in thinking that this problem is already fixed now in SVN? (I've been > using the cygwin v0.1.0 version). > > Yes, this should be fixed in svn. Cheers, Pedro Alves |