On Fri, Nov 23, 2012 at 9:13 AM, Ian Lynagh <ig...@earth.li> wrote: > > Hi all, > > I'm trying to use __HrLoadAllImportsForDll with delay loading DLLs, but > I have not been able to make it work. I wonder if anyone could help me > please?
Are you still having issues? > It seems that gcc makes an empty "Delay Import Directory" entry in the > data directory, so __HrLoadAllImportsForDll just fails with 8007007e > (The specified module could not be found). > > Is there a way of convincing gcc to make this section? Is this a bug? > (I have "gcc.exe (rubenvb-4.6.3) 4.6.3"). > > > > Here's a way to reproduce the problem: > > $ cat dll.c > > int f(int x) { > return x + 3; > } > > int g(int x) { > return x + 4; > } > > $ gcc -c dll.c > $ cat delaydll.def > > LIBRARY "dll.dll" > > EXPORTS > f > g > > $ dlltool -d delaydll.def -y delaydll.lib dll.o > $ gcc dll.o -o dll.dll -shared > $ cat test.c > > #include <stdio.h> > #include <Windows.h> > > int f(int x); > int g(int x); > > int main(int argc, char **argv) { > unsigned int i; > i = __HrLoadAllImportsForDll("dll.dll"); > if (FAILED(i)) { > printf("Delayed load failed %x\n", i); > exit(1); > } > printf("Result: %d\n", f(5)); > printf("Result: %d\n", g(6)); > return 0; > } > > $ gcc test.c delaydll.lib -o test > $ ./test > Delayed load failed 8007007e > $ objdump -p test.exe > [...] > The Data Directory > Entry 0 0000000000000000 00000000 Export Directory [.edata (or where ever we > found it)] > Entry 1 0000000000009000 00000938 Import Directory [parts of .idata] > Entry 2 0000000000000000 00000000 Resource Directory [.rsrc] > Entry 3 0000000000006000 00000240 Exception Directory [.pdata] > Entry 4 0000000000000000 00000000 Security Directory > Entry 5 0000000000000000 00000000 Base Relocation Directory [.reloc] > Entry 6 0000000000000000 00000000 Debug Directory > Entry 7 0000000000000000 00000000 Description Directory > Entry 8 0000000000000000 00000000 Special Directory > Entry 9 000000000000b000 00000028 Thread Storage Directory [.tls] > Entry a 0000000000000000 00000000 Load Configuration Directory > Entry b 0000000000000000 00000000 Bound Import Directory > Entry c 000000000000924c 00000210 Import Address Table Directory > Entry d 0000000000000000 00000000 Delay Import Directory > Entry e 0000000000000000 00000000 CLR Runtime Header > Entry f 0000000000000000 00000000 Reserved > [...] > > > > Thanks > Ian > > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public ------------------------------------------------------------------------------ Keep yourself connected to Go Parallel: TUNE You got it built. Now make it sing. Tune shows you how. http://goparallel.sourceforge.net _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public