This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: again: mixing GNU and MS tools/libraries...


vaf9143@madrona-a.iperbole.bologna.it wrote:
> 
> Hi there. Excuse me if I post this one again. Hitherto nobody
> answered to my previous post.
> Should this mean that anyone of you gurus outhere can help?
> This may mean several months of work for me, and abandon the Cygwin community
> to enter the MS world :-(
> Here is the problem:
> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> Hello. It looks like I am having a peculiar case to solve. It seems to me that
> recipes found in FAQ or in the mail archives don't apply.
> I am not a guru on MS and gnu related stuff... so coming to a dead end,
> I decided to post this one, hoping in somebody's help.
> 
> I developed an application on top of ME10 (a CAD program by HP), using the
> application
> interface which comes with ME10 distibution. This application (quite a huge
> one)
> runs fine on Unix and X, but I need to get the thing working on NT machines
> too.
> 
> On Unix I make a static link, but on NT I am forced to build a dll out of
> my stuff.
> In order to speed up conversion time I am tring to use the Cygwin tools and
> libraries.
> Well, I succeded in compiling all my stuff using gcc, then I made a big object
> (e.g. tnt.o or tnt.obj) using ld. In the code just one DllExport symbol is
> defined explicitly,
> which should serve to enter the module.
> At this point I have to merge tnt.o with an me10f.lib library to resolve
> ME10 related symbols.
> I made this by using link, and this seems to work, but I am still having 8
> undefined symbols:
>   __data_start__
>   ___DTOR_LIST__
>   __bss_start__
>   _mainCRTStartup
>   __data_end__
>   __bss_end__
>   ___CTOR_LIST__
>   __DllMainCRTStartup@12
> 
> So... what am I doing wrong, and what should I do at this point?
> Is it correct and safe to mix stuff compiled with gcc and MSVC, and then
> link it in part
> with GNU ld and in part with MS link?
> Obviously I don't have access to ME10 sources. Is it possible to convert
> the me10f.lib
> library, in a format compatible with ld, so that I can use just ld to link
> the whole thing?
> And which tools are available to do this conversion?

This depends on if me10f.lib is an import library for a ME10 dll or if
it is a static library. If it is a static library you may try linking
your dll with gnu tools. If you are not familiar with the process of
creating dll with gnu tools you may want to check out Mumit Khan's
howto's
and examples at http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
You will have to explicitly specify the path to me10f.lib when linking.

If me10f.lib is a dll import library you may try this:
echo EXPORTS >me10.def
nm me10f.lib | grep ' T _' | sed 's/.* T _/' >> me10.def
dlltool -k --output-lib libme10f.a --def me10.def --dllname
<name-of-dll>

and then linking with libme10f.a

It seems to me that your code (tnt.o) does not depend on any cygwin unix
stuff, so you may want to use mingw32 for your work since it is much
easier and less error-prone to create mingw32 dll's for interfacing with
other applications and it doesn't require the cygwin dll.

YMMW for what I said above.

Regards,
Anders

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com