c++.windows.32-bits - link files into *.dll
- Anuj Goyal (78/78) Apr 10 2005 c:\>cat a.c
- Jack (5/83) Apr 11 2005 c:\>dmc -WD a.c
- Anuj Goyal (78/78) Apr 30 2005 I still get the same problem
- Jack (3/81) May 02 2005 You forgot to link it with kernel32.lib ;)
- Anuj Goyal (4/94) May 02 2005 thanks Jack, .... argh stupid mistakes always get me. I was really hopi...
c:\>cat a.c #include <stdio.h> #include <stdlib.h> int foo() { int i=0; i += i++ + ++i; printf("i = %d\n",i); return 0; } C:\>dmc -c a.c C:\>link a.obj OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved h:\dm\bin\..\lib\SNN.lib(fplock) Error 42: Symbol Undefined _GetCurrentThreadId 0 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _SetFilePointer 16 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _CloseHandle 4 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 h:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 h:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 h:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 h:\dm\bin\..\lib\SNN.lib(_exit2) Error 42: Symbol Undefined _ExitProcess 4 h:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 h:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 h:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 h:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 h:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 h:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 h:\dm\bin\..\lib\SNN.lib(rtti) Error 42: Symbol Undefined _RaiseException 16 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetVersion 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 OPTLINK : Warning 134: No Start Address what is the syntax for creating a dll?
Apr 10 2005
In article <d3d09s$1fq9$1 digitaldaemon.com>, Anuj Goyal says...c:\>cat a.c #include <stdio.h> #include <stdlib.h> int foo() { int i=0; i += i++ + ++i; printf("i = %d\n",i); return 0; } C:\>dmc -c a.c C:\>link a.obj OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved h:\dm\bin\..\lib\SNN.lib(fplock) Error 42: Symbol Undefined _GetCurrentThreadId 0 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _SetFilePointer 16 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _CloseHandle 4 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 h:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 h:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 h:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 h:\dm\bin\..\lib\SNN.lib(_exit2) Error 42: Symbol Undefined _ExitProcess 4 h:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 h:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 h:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 h:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 h:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 h:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 h:\dm\bin\..\lib\SNN.lib(rtti) Error 42: Symbol Undefined _RaiseException 16 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetVersion 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 OPTLINK : Warning 134: No Start Address what is the syntax for creating a dll?c:\>dmc -WD a.c or just link it like how you link a normal windows application c:\>link /EXETYPE:NT /SUBSYTEM:WINDOWS a.obj, a.dll,,kernel32.lib http://www.digitalmars.com/ctg/optlink.html#operational
Apr 11 2005
I still get the same problem D:\jam>cat a.c #include <stdio.h> #include <stdlib.h> int foo() { int i=0; i += i++ + ++i; printf("i = %d\n",i); return 0; } D:\jam>dmc -WD a.c link a,,,,a/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved h:\dm\bin\..\lib\SNN.lib(fplock) Error 42: Symbol Undefined _GetCurrentThreadId 0 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _SetFilePointer 16 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _CloseHandle 4 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 h:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 h:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 h:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 h:\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 h:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 h:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 h:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 h:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 h:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 h:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 h:\dm\bin\..\lib\SNN.lib(rtti) Error 42: Symbol Undefined _RaiseException 16 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetVersion 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 --- errorlevel 31
Apr 30 2005
In article <d51qnh$2075$1 digitaldaemon.com>, Anuj Goyal says...I still get the same problem D:\jam>cat a.c #include <stdio.h> #include <stdlib.h> int foo() { int i=0; i += i++ + ++i; printf("i = %d\n",i); return 0; } D:\jam>dmc -WD a.c link a,,,,a/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved h:\dm\bin\..\lib\SNN.lib(fplock) Error 42: Symbol Undefined _GetCurrentThreadId 0 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _SetFilePointer 16 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _CloseHandle 4 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 h:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 h:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 h:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 h:\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 h:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 h:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 h:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 h:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 h:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 h:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 h:\dm\bin\..\lib\SNN.lib(rtti) Error 42: Symbol Undefined _RaiseException 16 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetVersion 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 --- errorlevel 31You forgot to link it with kernel32.lib ;) dmc -WD a.c kernel32.lib
May 02 2005
thanks Jack, .... argh stupid mistakes always get me. I was really hoping that i would not need to link in kernel32.lib for such a simple function. I should have known better. In article <d54r6r$1a4j$1 digitaldaemon.com>, Jack says...In article <d51qnh$2075$1 digitaldaemon.com>, Anuj Goyal says...I still get the same problem D:\jam>cat a.c #include <stdio.h> #include <stdlib.h> int foo() { int i=0; i += i++ + ++i; printf("i = %d\n",i); return 0; } D:\jam>dmc -WD a.c link a,,,,a/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved h:\dm\bin\..\lib\SNN.lib(fplock) Error 42: Symbol Undefined _GetCurrentThreadId 0 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalFree 4 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _WriteFile 20 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _GlobalAlloc 8 h:\dm\bin\..\lib\SNN.lib(write) Error 42: Symbol Undefined _SetFilePointer 16 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _GetStdHandle 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _SetHandleCount 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _DeleteFileA 4 h:\dm\bin\..\lib\SNN.lib(io) Error 42: Symbol Undefined _CloseHandle 4 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _CreateSemaphoreA 16 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _ReleaseSemaphore 12 h:\dm\bin\..\lib\SNN.lib(semlock) Error 42: Symbol Undefined _WaitForSingleObject 8 h:\dm\bin\..\lib\SNN.lib(wctomb) Error 42: Symbol Undefined _WideCharToMultiByte 32 h:\dm\bin\..\lib\SNN.lib(ISMBDIGI) Error 42: Symbol Undefined _GetStringTypeA 20 h:\dm\bin\..\lib\SNN.lib(setnterr) Error 42: Symbol Undefined _GetLastError 0 h:\dm\bin\..\lib\SNN.lib(_exit) Error 42: Symbol Undefined _ExitProcess 4 h:\dm\bin\..\lib\SNN.lib(w32fater) Error 42: Symbol Undefined _WriteConsoleA 20 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetACP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetOEMCP 0 h:\dm\bin\..\lib\SNN.lib(setmbcp) Error 42: Symbol Undefined _GetCPInfo 8 h:\dm\bin\..\lib\SNN.lib(read) Error 42: Symbol Undefined _ReadFile 20 h:\dm\bin\..\lib\SNN.lib(isatty) Error 42: Symbol Undefined _GetFileType 4 h:\dm\bin\..\lib\SNN.lib(except) Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4 h:\dm\bin\..\lib\SNN.lib(signal) Error 42: Symbol Undefined _SetConsoleCtrlHandler 8 h:\dm\bin\..\lib\SNN.lib(ehsup) Error 42: Symbol Undefined _RtlUnwind 16 h:\dm\bin\..\lib\SNN.lib(rtti) Error 42: Symbol Undefined _RaiseException 16 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualFree 12 h:\dm\bin\..\lib\SNN.lib(sbrk) Error 42: Symbol Undefined _VirtualAlloc 16 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetEnvironmentStrings 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _GetVersion 0 h:\dm\bin\..\lib\SNN.lib(cinit) Error 42: Symbol Undefined _FreeEnvironmentStringsA 4 --- errorlevel 31You forgot to link it with kernel32.lib ;) dmc -WD a.c kernel32.lib
May 02 2005