Winelib Program with DLL problem

Boaz Harrosh boaz at hishome.net
Sun Dec 28 07:27:17 CST 2003


Dmitry Timoshkov wrote:

>Foo.spec:
>
>@ stdcall fnFooSTD at 8@8(long long) fnFooSTD
>@ cdecl   fnFooC  (long long) fnFooC
>
>resulted Foo.spec.c:
>
>asm(".data\n"
>    "\t.align 4\n"
>    "__wine_spec_exports:\n"
>    "\t.long 0\n"
>    "\t.long 0\n"
>    "\t.long 0\n"
>    "\t.long __wine_spec_exp_names\n"
>    "\t.long 1\n"
>    "\t.long 2\n"
>    "\t.long 2\n"
>    "\t.long __wine_spec_exports_funcs\n"
>    "\t.long __wine_spec_exp_name_ptrs\n"
>    "\t.long __wine_spec_exp_ordinals\n"
>    "__wine_spec_exports_funcs:\n"
>    "\t.long fnFooC\n"
>    "\t.long fnFooSTD\n"
>    "__wine_spec_exp_name_ptrs:\n"
>    "\t.long __wine_spec_exp_names+8\n"
>    "\t.long __wine_spec_exp_names+15\n"
>    "\t.text\n"
>    "__wine_spec_exp_names:\n"
>    "\t.string \"Foo.dll\"\n"
>    "\t.string \"fnFooC\"\n"
>    "\t.string \"fnFooSTD at 8\"\n"
>                 ^^^^^^^^^^<----------------------------<<<<<<<<<
>    "\t.data\n"
>    "__wine_spec_exp_ordinals:\n"
>    "\t.short 0\n"
>    "\t.short 1\n"
>    "\tjmp fnFooC\n"
>    "\tret\n"
>    "\t.short 8\n"
>    "\t.long fnFooC,0x00000000\n"
>    "\tjmp fnFooSTD\n"
>    "\tret $8\n"
>    "\t.long fnFooSTD,0x00000000\n"
>    "\t.text\n"
>    "\t.align 4\n"
>);
>
>As you can see it works for me.
>
>  
>

Dear Dmitry you have been most patience with me and I already feel silly 
but please I am not able to reproduce your results.

1) I have put above two lines in a Foo.dll.spec file

2) Here is my command line dump:
* gcc -c -I. -I/home/wine/include/wine/windows -g -fPIC -D_REENTRANT -o 
fooapp.o fooapp.c
* LD_LIBRARY_PATH="/home/wine/lib" /home/wine/bin/winebuild -fPIC -o 
libFoo.def --def Foo.dll.spec
* LD_LIBRARY_PATH="/home/wine/lib" /home/wine/bin/winebuild -fPIC -o 
fooapp.exe.spec.c --exe fooapp.exe fooapp.o -L. -lFoo 
-L/home/wine/lib/wine -ladvapi32 -lkernel32 -lshell32 -luser32



3) Here is my result fooapp.exe.spec.c:
 ....

} imports = {
  {
    { 0, 0, 0, "Foo.dll", &imports.data[0] },
    { 0, 0, 0, "kernel32.dll", &imports.data[2] },
    { 0, 0, 0, 0, 0 },
  },
  {
    /* Foo.dll */
    "\001\000fnFooC",
    0,
    /* kernel32.dll */
    "\045\001ExitProcess",
    "\215\001GetCommandLineA",
    "\373\001GetModuleHandleA",
    "\056\002GetStartupInfoA",
    0,
  }
};

#ifndef __GNUC__
static void __asm__dummy_import(void) {
#endif

asm(".data\n\t.align 8\n"
    "\t.type fnFooC, at function\n"
    "\t.globl fnFooC\n"
    "fnFooC:\n\tjmp *(imports+60)\n\tmovl %esi,%esi\n"
    "\t.type ExitProcess, at function\n"
    "\t.globl ExitProcess\n"
    "ExitProcess:\n\tjmp *(imports+68)\n\tmovl %esi,%esi\n"
    "\t.type GetCommandLineA, at function\n"
    "\t.globl GetCommandLineA\n"
    "GetCommandLineA:\n\tjmp *(imports+72)\n\tmovl %esi,%esi\n"
    "\t.type GetModuleHandleA, at function\n"
    "\t.globl GetModuleHandleA\n"
    "GetModuleHandleA:\n\tjmp *(imports+76)\n\tmovl %esi,%esi\n"
    "\t.type GetStartupInfoA, at function\n"
    "\t.globl GetStartupInfoA\n"
    "GetStartupInfoA:\n\tjmp *(imports+80)\n\tmovl %esi,%esi\n"
".text");
#ifndef __GNUC__
}
#endif
....

I have noticed that my .spec.c file is very different than your .spec.c 
file from above. I am using winebuild downloaded from source forge, as 
of 20031212.

Now if I use your suggested .spec file. I am missing the FooSTD 
altogether. If I remove one of the @8 than I am back to my old problem.

[Q-1] Why is my .spec.c file so different than yours? could you please 
check my command line switches? could you please send me your makefiles 
(command line) that produced above results.

[Q-2] I Have mandrake 9.1, GCC 3.3.1, winebuild extracted from 
Wine-20031212-i386-S9nodebug-2.tgz downloaded from sourceforge. Is 
winebuild a simple elf program that only dependent on GLIBC? or is it 
using other binary files/libraries that I should check versions of? 
Mainly is it dependent on any other wine utility/library?

Thanks in advance. And happy holidays
Boaz




More information about the wine-devel mailing list