[m-dev.] Link error for mercury_mcpp.cpp

Peter Ross pro at missioncriticalit.com
Tue Oct 7 19:57:08 AEST 2003


On Tue, Oct 07, 2003 at 01:22:44AM +1000, Fergus Henderson wrote:
> On 06-Oct-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > The two problems I have encountered so far are:
> >     * runtime/mercury_mcpp.cpp no longer compiles, I get the link error
> >         LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol
> >           _main referenced in function _mainCRTStartup
> >         mercury_mcpp.dll : fatal error LNK1120: 1 unresolved externals
> 
> That looks like it is being compiled/linked with the wrong options,
> causing the linker to try to link it as a program with main().
> 
> This in is probably due to the odd options that we compile it with.
> The right option probably ought to be "/clr:noAssembly", but that
> didn't work with 1.0, so we used "/link /noassembly" instead.
> 
> The reason for the need for special options was that we are calling
> a native code library function, putenv().
> 
Even using
    cl /clr:noAssembly /LD mercury_mcpp.cpp
we get the problem.

In fact we get the problem, even for the following very simple file
compiled with the same options as above.

#using <mscorlib.dll>
namespace mercury {
namespace runtime {
__gc public class SystemException : public System::Object
{
public:
};
}
}

This is what I mean about the MC++ support being brittle.  If you can
work out what the problem I would be very grateful.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list