The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: asmman on July 21, 2006, 01:47:59 AM

Title: LNK2001
Post by: asmman on July 21, 2006, 01:47:59 AM
{EDIT} Trying to make this more clear.
Ok,  I am trying to create a DLL based on the DLLTute examples  and I am stuck.  I am getting:  (FYI I am in WIN 98 SE)

     LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
    ODBCMain.dll : fatal error LNK1120: 1 unresolved externals

when I run the link.  The code assembles with no errors.  I am using Console API functions (AllocConsole, FreeConsole etc) so that may have something to do with this though I don't know what.

I am using the following bat script to compile and link:
    echo off
    REM Check to see if Object & DLL files exist, if so delete them
   
    if exist ODBCMain.obj del ODBCMain.obj
    if exist ODBCMain.dll del ODBCMain.dll

    C:\masm32\bin\ml.exe /c /coff  C:\WinAsm~1\WinAsm\MyProj~1\ODBCMain\ODBCMain.asm

   C:\masm32\bin\link.exe /SUBSYSTEM:CONSOLE /DLL /VERBOSE /DEF:C:\WinAsm~1\WinAsm\MyProj~1\ODBCMain\ODBCMain.def C:\WinASm~1  \WinAsm\MyProj~1\ODBCMain\ODBCMain.obj

    dir C:\WinAsm~1\WinAsm\MyProj~1\ODBCMain\ODBCMain.*
    pause

I tried using /SUBSYSTEM:WINDOWS also but I get the same error.  The VERBOSE option doesn't help for the link.   I can't scroll the MS-DOS PROMPT backwards to look at the output.  Is there someway I can direct the link output to a file?  I did try using /OUT but that doesn't seem to work... 

My DLL source is attached.... 
Thanks


[attachment deleted by admin]
Title: Re: LNK2001
Post by: zooba on July 21, 2006, 01:52:24 AM
I haven't looked at your source, but probably you haven't got END DllMain at the end of ODBCMain.asm.

The VERBOSE option generally relates only to the modules which are linked and isn't useful. Console output can be redirected by putting a greater-than sign (>) at the end of the line followed by a filename (or CON for the console or NUL for nowhere). A 2 before the > (ie. 2>) will redirect standard-error, while a less-than sign (<) will pass the contents of the file specified to standard-input.

Cheers,

Zooba :U
Title: Re: LNK2001
Post by: asmman on July 26, 2006, 12:25:47 PM
Thanks to Zooba!

I added "End LibMain" to match my Proc name and got rid of this error. 

Thanks for the help! :bg