Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2006

Tip: Looking for answers? Try searching our database.

NAnt linking problems : LNK1256

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
harleybl@gmail.com - 13 Apr 2006 16:53 GMT
Hello,

  I have a C++ mixed mode dll ( unmanaged/managed ) that wraps a C#
dll to provide some functionality for Microsoft Excel. I am able to
compile my solution fine in Visual Studio .NET 2003 and it links and
works with no errors. There is a desire at my company to have things
checked out of source control and built on a machine dedicated to
building to remove the "I don't know, it works on my machine" problem.

 I have created an NAnt script which compiles my C++ classes and then
attempts to link them into a dll. I made sure that the parameters that
are passed to the cl task and the link task are the same as in the
build log that MSVC .Net generates when it builds the solution
correctly.

 However at the end of the build I get this error :
    [link] LINK : fatal error LNK1256: ALINK operation failed
(8013110E) :

 I looked around on MSDN and it said that there might be some version
incompatibility between the linker and alink.dll. My versions appear to
be in line with what is distributed on the CD.

 I saw another posting that link needs the windir set within the
command shell you are using. In my command prompt it is set.

Has anyone run into a similar problem. Does anyone have an idea? Does
the hex value within the parenthesis have any meaning?

Thanks,
Harley Blumenfeld
Marcus Heege - 13 Apr 2006 18:03 GMT
Do you sure you execute this from the VS 2003 command propmt?
Do you also have VS 2002 or VS 2005 installed on the machine?

> Hello,
>
[quoted text clipped - 27 lines]
> Thanks,
> Harley Blumenfeld
harley - 17 Apr 2006 14:03 GMT
I am sure that I don't have Visual Studio 2005 on this machine.
My development machine was imaged from a machine that had
Visual Studio 2002 on it, but I uninstalled that before I installed
VS 2003 .NET.

The only version of alink.dll that I have is in the
C:\WINNT\Microsoft.NET\Framework\v1.1.4322
directory and is version 7.10.3052.4.

The version of the linker that I have is in
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
and it's version is 7.10.3077.0 which is higher than the other
version so that is probably the reason for the error.

What I am wondering is why it works within Visual Studio, but not from
NAnt when I only have 1 version of the linker and the required dll?

Also I believe that I am using the exact linker from the command prompt
as VS 2003 because I am taking the options from the build log.

Thanks for replying...

-Harley
Marcus Heege - 18 Apr 2006 10:26 GMT
I have the same versions of link.exe and alink.dll as you. Could it be a
conflict with another DLL that is by accident named alink.dll?

Marcus

>I am sure that I don't have Visual Studio 2005 on this machine.
> My development machine was imaged from a machine that had
[quoted text clipped - 19 lines]
>
> -Harley
harley - 18 Apr 2006 16:48 GMT
I got it to work!!!!

The problem was with the way that NAnt handles modules... or maybe I
just misunderstood how nant handles modules. I had assumed that the
<modules/> section of the link task would just include a list of
modules like VS 2003 .NET does at the end of the command line, before
the object files.

However it does not, instead nant adds /ASSEMBLYMODULE:[path to module]
for each one it finds in the the modules fileset. I guess the
documentation could be a little clearer.

In my modules section I had this xml :
             <modules>
                <include name="kernel32.lib" />
                               <!-- removed for brevity /-->
                <include name="c:/Program Files/Microsoft Visual Studio .NET
2003/Sdk/v1.1/Lib/mscoree.lib">
             </modules>

So NAnt was adding /ASSEMBLYMODULE:c:/Program Files/Microsoft Visual
Studio .NET 2003/Sdk/v1.1/Lib/mscoree.lib to the linker command line.
NAnt was ignoring kernel32.lib and all the other modules since I did
not set a basedir attribute of the modules section, and it could not
find them.

I removed my modules section and added the lib files I needed to the
options attribute of the task element to mimic the way the linker in VS
2003.NET calls the linker.

I was tipped of to the cause of the problem by this bug on sourceforge.
http://sourceforge.net/tracker/index.php?func=detail&aid=1165130&group_id=31650&
atid=402868


Thank you for all your help Marcus.

-Harley

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.