Re: Convert GCC under Cygwin Name Mangling to VC++ Name Mangling

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

 



Hello once again,

I have tried many things. I will try to explain all of them.

1st:
----
I tried to use the extern "C" and it did link. I created a simple "mydll.dll"
with a "void myproc1() { return; }" and after compiling it with cygwin it
linked under VC++ .net but when I run the program and it has to run "myproc1" I get a Windows error-window ".. has encountered a problem and needs to close. We
are sorry (LoL) for the inconvenience". I have even turned DEP off.

2nd:
----
I tried to do a explicit dll linking. With the same mydll.dll I tried using the
example provided by VC++ help for explicit linking. The "LoadLibrary" hangs.
When it is at that point the program freezes and does nothing else.

3rd:
----
As M. Haubenwallner suggested, I tried downloading 'wgcc' but it din't work for cygwin as well. I read "INSTALL" procedure and it was able to run "./configure"
and "make" but when I did "make check" I got twice

warning: wrapper header set but not available!
error  : execution of task seemed to fail, return code 13568
fatal  : compiler queue didn't complete, cannot continue

and at the bottom........

======================
9 of 9 tests failed
(1 tests were not run)
======================
make[2]: *** [check-TESTS] Error 1
make[2]: Leaving directory `/wgcc/build.wgcc/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/wgcc/build.wgcc/tests'
make: *** [check-recursive] Error 1

What I did next was to download 'Microsoft Windows services for Unix' and tried
to compile and run wgcc there but it was even funnier. After solving problems
like getting "Memory fault (core dumped)" for every single thing I tried to do,
I tried to run "./configure" for wgcc and what I got (when compiling
conftest.cc, a simple main which has a "return 0" statement) was:
gcc: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I have no idea what I can do, can anyone please help me???


Quoting Michael Haubenwallner <michael.haubenwallner@xxxxxxxxxx>:

Hi Francisco,

as you said you have a shared-library initially built on Linux, I assume
you have some gcc-bound build mechanism (ev. autotools+libtool ?), which
is why you started using gcc on cygwin, right ?

And very likely, you include some system headers not available on
Windows (fex unistd.h) ?

I'm sure it is worth a try to look at 'wgcc', which is a full featured
wrapper around MS 'cl.exe', behaving like gcc as much as possible,
including the ability to build shared libraries, but using MS 'cl.exe'
as the underlying compiler: http://sourceforge.net/projects/interix-wgcc

We are able to build a bunch of opensource packages with cl.exe (through
wgcc) both as static and shared libraries, using their normal build
procedure (mostly automake+autoconf+libtool+GNU make), with minimal
sourcecode changes.
While the build environment is cygwin or interix (eventually MinGW), the
output is real plain windows without the need for any cygwin1.dll or
psxdll.dll.

/haubi/

On Wed, 2006-12-13 at 19:42 +0100, Francisco J. Royo Santas wrote:
Quoting John Love-Jensen <eljay@xxxxxxxxx>:

> Hi Francisco,
>
> Given your situation, it sounds like the bigger project is using MS Dev
> Studio's Visual C++.
>
> The GCC C++ ABI is not compatible with the MS Dev Studio VC++ ABI.
>
> Either the bigger project will need to be compiled with GCC, or your
> package-made-for-Linux will have to be compiled with MSVC++, or you will
> have to create a C ABI edge that is the interface from the GCC C++ world to
> the MSVC++ world.
>
> The C ABI is compatible between the two compilers.  The C++ ABIs are not
> compatible.
>
> What does "not compatible ABI" mean in this context?  The RTTI is
> incompatible, the exception handling is incompatible, the name mangling is
> incompatible, the parameter pushing is incompatible, the calling convention > is incompatible, the stack clean up is incompatible, the stack unwinding is
> incompatible, and probably a handful of other catastrophic differences.
>
> If you write a C edge, you cannot leak RTTI information, or throw an
> exception past the C barrier (instant program termination), et cetera.
>
> HTH,
> --Eljay
>
>


Oh :(:( Thank you very much anyway, I hoped it could be possible. How
can I do a
C edge for a C++ class? This class has 6 or 7 variables of types which are
defined inside the DLL so it's a bit complicated because the functions I need
to use in the class make use of these variables which have to be
initialized at
the beginning of the execution and it takes a long time (10 seconds)
while the function takes less than 0.03 seconds. Time is important. If
everything fails,
I will have to create a socket to communicate a gcc-compiled program with the big VC++-compiled big project but I want to try everything before changing to
this solution.

Thanks and g'bye

--
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:michael.haubenwallner@xxxxxxxxxx  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html





Francisco J. Royo Santas


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux