Re: Using Monodevelop to write Winelib apps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/6/10 12:01 AM, Progman3K wrote:
> Hi,
> 
> I'm using Monodevelop to write Win32-API applications.
> 
> I have no trouble getting the Monodevelop compiler (gcc/g++) to compile the code, but I am having problems getting the app to link:
> 
> g++ -shared -o "dtrace/bin/Debug/libdtrace.so" "dtrace/bin/Debug/main.o" "/usr/lib64/libwine.so"  
> dtrace/bin/Debug/main.o: In function `DllMain':
> dtrace/src/main.cpp:25: undefined reference to `InitializeCriticalSection'
> dtrace/src/main.cpp:41: undefined reference to `GlobalHandle'
> dtrace/src/main.cpp:41: undefined reference to `GlobalUnlock'
> dtrace/src/main.cpp:41: undefined reference to `GlobalHandle'
> dtrace/src/main.cpp:41: undefined reference to `GlobalFree'
> dtrace/src/main.cpp:48: undefined reference to `DeleteCriticalSection'
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/../../../../x86_64-pc-linux-gnu/bin/ld: dtrace/bin/Debug/libdbgtrace.so: hidden symbol `LeaveCriticalSection' isn't defined
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
> collect2: ld returned 1 exit status
> Build complete -- 40 errors, 13 warnings
> 
> My question is, where are the Win32 API functions located for the linker? What are their names? .a files? .so files?
Neither.

It's kinda weird actually. First you have to run winebuild on the object
files, so it can generate import stubs. Then you have to assemble (yes,
assemble) and link these stubs to your object files. This is because of
the way importing functions from Wine DLLs works (it's designed to be
compatible with Windows).

Luckily, you don't have to do all this by hand. The winegcc tool does
all this for you. So, you invoke wineg++ instead of plain g++. Also, you
have to tell it you want to link to kernel32.dll by passing it -lkernel32.

Hope that helps.

Chip


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux