[Wine] problem build wine lib
wineforum-user at winehq.org
Sun May 18 04:38:50 CDT 2008
This is my first post here, please excuse any incorrect terms etc. I have tried to follow chapter 5 of winelib-guild.pdf, but found winemaker does not correspond to the pdf.
I am using wine version 1.0-rc1. I am trying to call a Linux shared library from an unmodified windows C++ program using a C interface to a DLL. I have built very simple test case that I would like help to compile. Sorry for long post.
File 1. header file to define the interface between the windows program and windows DLL
char * winFunc(bool select);
File 2 the windows program
int main(int argc, char * argv)
char * str = winFunc(false);
printf("main: got %s\n", str);
File 3 the windows DLL
__declspec(dllexport) char * winFunc(bool select)
These have been compiled using MinGW on linux and produced files that work on windows, and with wine.
File 4. Linux Shared library header
char * linuxFunc(bool select);
File 6 Linux Shared library cpp
char * linuxFunc(bool select)
File 5 and 6 compiled using gcc on linux.
File 7 spec file for wine dll
@ stdcall winFunc (long)
File 8 Library code#include "WinFunc.h"
#include <windef.h> /* Part of the Wine header files */
char * WINAPI winFunc(bool select)
The spec file was processed with command
winebuild --dll --export=../WinToLinux.spec --external-symbols --subsystem=native --library-path=../../WinLib/Debug --output=Wrapper.o
The C++ code was compiled with command
wineg++ -I"/Work/work/workspace/Wine/WinLib" -I"/Work/work/workspace/Wine/LinuxLib" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"WinToLinux.d" -MT"WinToLinux.d" -o"WinToLinux.o" "../WinToLinux.cpp"
And linked with
wineg++ -L"/Work/work/workspace/Wine/LinuxLib/Debug" -specs ../WinToLinux.spec -shared -o"WinToLinux.dll.so" ./WinToLinux.o ./Wrapper.o -lLinuxLib
But get the following error
./Wrapper.o(.data+0x0): In function `__wine_spec_nt_header':
: multiple definition of `__wine_spec_nt_header'
WinToLinux.dll-b7fdrU.spec.o(.data+0x0): first defined here
./Wrapper.o(.rodata+0x0): In function `__wine_spec_file_name':
: multiple definition of `__wine_spec_file_name'
WinToLinux.dll-b7fdrU.spec.o(.rodata+0x0): first defined here
./Wrapper.o(.data+0x28): In function `__wine_spec_nt_header':
: undefined reference to `null'
collect2: ld returned 1 exit status
winegcc: g++ failed
make: *** [WinToLinux.dll.so] Error 2
1. What am I doing wrong or not doing?
2. Where can I find a how to?
3. Is this the correct approach?
The bigger picture is I need to share memory and other services between linux application and windows application, running at the same time.
Hopefully someone will be able to answer my questions or direct me to where I can find answers. I have tried Google but have had no luck.
If I would be better serviced by CodeWeaver, I am happy to go that way, But my view was that for this forum was the most suitable for this type of question.
More information about the wine-users