From: Duft M. <Mar...@sa...> - 2006-10-11 06:46:50
|
Hi! Wgcc is capable of building shared libs .dll with import libs that use .so to emulate gcc's behaviour. This .so libraries may be linked by both, but mixing of compilers is extremely dangerous. Linking wgcc compiled objects is only possible if you change the runtime from dynamic to static either by giving -X/MT on the command line or changeing the $prefix/etc/.wgccrc file to use /MT instead of /MD. Then it works... I really have no idea when i'll have time to look into this. I would have to take alook at CC/C89 again (my first approach was changing those ;o)) and implement some stuff in wgcc... Cheers, Markus=20 -----Original Message----- From: Martin Koeppe [mailto:mk...@gm...]=20 Sent: Wednesday, October 11, 2006 1:00 AM To: Duft Markus Cc: int...@li... Subject: RE: wgcc does not build Hi Markus, > I wrote wgcc with the main intention to get native windows binaries=20 > that are plain win32 and have nothing to do anymore with any unix=20 > subsystem or something, since this gave lots of problems, especially=20 > with debugging. For example try to build wgcc debuggable with gcc and=20 > debug with gdb -> it's really impossible ;o) yes, that's a problem. :-( > Debugging with visual studio is really cool only when building really=20 > native (linking with link.exe) maybe the best woulb be building with=20 > gcc and linking with link.exe. agreed here, too. To continue my last mail for motivations for creating POSIX-CUI exes with MS tools, I have these: - One could have link.exe via wgcc as drop-in replacement for ld, which is buggy in some situations. (Of course then there is only static linking...) - gcc/g++ 3.3 is rather old now, so cl.exe could be used, e.g. instead of g++ to have better C++ support. > If you look at the source code of wgcc it would be not a big problem > implementing alternative compiler/linker tasks, since everything is > really modular. sounds good. > At the moment i don't have enough time to work on this, but i will take > a look at it in the near future, since it sounds promising and desirable > to make wgcc able of using the interix tools too. This would make wgcc > the most powerfull build tool for interix around (and most configurable > one)... > > I played around with wgcc and ld, and it seems to work for a small hello > world.... Really cool would have been beeing able of using msvcrt libc > when linking with ld, but there seem to be some restriction, since i > can't seem to be able to execute the resulting binary (but link goes ok > without even a warning)... > > As far as i now see, using either ld or gcc forces the use of the > interix libc & co. This is for our (company) current situation not > really desireable as i allready said, but since wgcc is an open source > project i'm willing to spend some time in implementing this anyway - > when i got some time ;o) Thank you. Can you approximately say, when this might happen? > As far as building bash & co. With cl.exe is concerned: be aware of > compiler capability differences... For example gcc uses > __atribute__(...) and MS uses __declspec(...) which each other don't > understand. So the sources will most likely not build. One more thing > is, that you would have to first port libtermcap or libncurses or so to > cl.exe, which as far as i know would be _really much_ work... >From gcc-4.1 docs: You can use __declspec(dllexport) as a synonym for __attribute__=20 ((dllexport)) for compatibility with other compilers. But: for .so files, you don't need any of __attribute__ or __declspec.=20 .so libs are not DLLs! I currently don't know much technical detail,=20 but they are different. That's why only ld can link (to) them. The=20 general idea is of course the same, though. See here for some details: http://www.interopsystems.com/tools/tm.aspx?m=3D7904 >> Many questions ;o) maybe you want to try (after wgcc works ;o)) to=20 >> only compile with wgcc, and manually link with ld and gather some=20 >> experience in this direction.... I will try too! > > Ok, will try with wgcc, too. This doesn't work, because wgcc compiles with Win32 libc headers, so=20 gcc/ld complains when linking: $ wgcc -g -c -o hello.o hello.c $ gcc hello.o hello.o(.text+0xc): undefined reference to `__imp__printf' collect2: ld returned 1 exit status Martin |