www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Making a DLL

reply Mac Reiter <Mac_member pathlink.com> writes:
I am attempting to build a DLL using DMC 8.34 and the tool chain from the CD.

My initial attempts simply used the '-mn -WD' options and listed the code files.
When that failed, I fired up the IDDE and set up a Win32 DLL project.  In both
cases, I get the same giant list of errors involved being unable to export
symbols.

I am sure that I'm just doing something foolish.  In particular, I have not
added GDI32.lib and other system libraries that I need to build the project.  I
don't directly see how that would cause the "cannot export" errors, but I
certainly see how it would cause the "undefined" errors.

Here is an abbreviated example of the output.  I cut out most of my member
functions, because they were boring.  I left the "undefined" errors for the
various library functions alone, in case those were somehow useful.  Any
suggestions would be greatly appreciated.

Mac Reiter
reiter nomadics.com

nomadicsgraphdll.obj(nomadicsgraphdll)  Offset 04BA2H Record Type 0091 
Error 1: Previous Definition Different : _GarbageReturn
nomadicsgraphdll.obj(nomadicsgraphdll)  Offset 04BB6H Record Type 0091 
Error 1: Previous Definition Different : _GarbageReturn
nomadicsgraphdll.obj(nomadicsgraphdll)  Offset 04BCAH Record Type 0091 
Error 1: Previous Definition Different : _GarbageReturn
nomadicsgraphdll.obj(nomadicsgraphdll)  Offset 04BDEH Record Type 0091 
Error 1: Previous Definition Different : _GarbageReturn
nomadicsgraphdll.obj(nomadicsgraphdll)  Offset 04BF8H Record Type 0091 
Error 1: Previous Definition Different : _GarbageReturn
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : CreateGraph
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : DestroyGraph
nomadicsgraphdll.obj(nomadicsgraphdll) 
Error 42: Symbol Undefined _InterlockedIncrement 4
nomadicsgraphdll.obj(nomadicsgraphdll) 
Error 42: Symbol Undefined _InterlockedDecrement 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GetTextExtentPoint32A 16
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _IntersectClipRect 20
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _DeleteDC 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GetLastError 0
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _EndDoc 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _EndPage 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GetDeviceCaps 8
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _StartPage 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _StartDocA 8
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GlobalUnlock 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _CreateDCA 16
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GlobalLock 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _PageSetupDlgA 4
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _SelectClipRgn 8
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _SetTextColor 8
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _SetBkColor 8
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GetTickCount 0
nomadicsgraph.obj(nomadicsgraph) 
Error 42: Symbol Undefined _GetLocalTime 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CloseHandle 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _DeleteObject 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _SelectObject 8
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _WriteFile 20
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _GdiFlush 0
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _BitBlt 36
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateDIBSection 24
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateCompatibleDC 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateFileA 28
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _GetDIBits 28
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateCompatibleBitmap 12
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreatePen 12
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _Polyline 12
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _StretchBlt 44
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _SetPixel 16
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _GetPixel 12
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateSolidBrush 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateFontIndirectA 4
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _MulDiv 12
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _PatBlt 24
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateRectRgn 16
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _GetClipRgn 8
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _SetBkMode 8
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _CreateFontA 56
nomadicspicture.obj(nomadicspicture) 
Error 42: Symbol Undefined _GetStockObject 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(dllstart) 
Error 42: Symbol Undefined _GetCurrentThreadId 0
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(dllstart) 
Error 42: Symbol Undefined _GetVersion 0
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(isctype) 
Error 42: Symbol Undefined _GetStringTypeA 20
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(cinit) 
Error 42: Symbol Undefined _GetEnvironmentStrings 0
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(cinit) 
Error 42: Symbol Undefined _FreeEnvironmentStringsA 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(semlock) 
Error 42: Symbol Undefined _CreateSemaphoreA 16
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(semlock) 
Error 42: Symbol Undefined _ReleaseSemaphore 12
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(semlock) 
Error 42: Symbol Undefined _WaitForSingleObject 8
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(signal) 
Error 42: Symbol Undefined _SetConsoleCtrlHandler 8
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(wctomb) 
Error 42: Symbol Undefined _WideCharToMultiByte 32
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(_exit) 
Error 42: Symbol Undefined _ExitProcess 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(tolower) 
Error 42: Symbol Undefined _LCMapStringA 24
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(MBTOWC) 
Error 42: Symbol Undefined _MultiByteToWideChar 24
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(io) 
Error 42: Symbol Undefined _GetStdHandle 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(io) 
Error 42: Symbol Undefined _SetHandleCount 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(io) 
Error 42: Symbol Undefined _DeleteFileA 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(except) 
Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(flush) 
Error 42: Symbol Undefined _SetFilePointer 16
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(setmbcp) 
Error 42: Symbol Undefined _GetACP 0
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(setmbcp) 
Error 42: Symbol Undefined _GetOEMCP 0
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(setmbcp) 
Error 42: Symbol Undefined _GetCPInfo 8
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(w32fater) 
Error 42: Symbol Undefined _WriteConsoleA 20
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(ehsup) 
Error 42: Symbol Undefined _RtlUnwind 16
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(rtti) 
Error 42: Symbol Undefined _RaiseException 16
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(sbrk) 
Error 42: Symbol Undefined _VirtualFree 12
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(sbrk) 
Error 42: Symbol Undefined _VirtualAlloc 16
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(write) 
Error 42: Symbol Undefined _GlobalFree 4
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(write) 
Error 42: Symbol Undefined _GlobalAlloc 8
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(read) 
Error 42: Symbol Undefined _ReadFile 20
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(isatty) 
Error 42: Symbol Undefined _GetFileType 4
OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP
D:\DEVTOOLS\DM\BIN\..\lib\SNN.lib(dllstart) 
Error 83: Illegal frame on start address 
OPTLINK : Warning 174: 32-bit Segments Inappropriate for 16-bit Segmented output

OPTLINK : Error 81: Cannot EXPORT : CreateGraph
OPTLINK : Error 81: Cannot EXPORT : DestroyGraph
nomadicsgraphdll.obj(nomadicsgraphdll) 
Error 35: Cannot Reach TARGET from FRAME at Relative 0003BH  from
Segment _TEXT
FRAME  = Frame of Group FLAT 0000
TARGET = External Symbol ??1NomadicsGraph  QAE XZ (syscall
NomadicsGraph::~NomadicsGraph(void )) 05F45H 
FIXUPP Type = 32-bit Conditional JMP

--- errorlevel 440
Aug 25 2003
parent Mac Reiter <Mac_member pathlink.com> writes:
Never mind...  After I included gdi32.lib, kernel32.lib, and comdlg32.lib on my
build line, the imports worked and, suddenly, the exports were perfectly happy.
Don't know why, but it works, and I've got a DLL.

Sorry for the wasted bandwidth.
Mac

In article <bidukv$258l$1 digitaldaemon.com>, Mac Reiter says...
I am attempting to build a DLL using DMC 8.34 and the tool chain from the CD.

My initial attempts simply used the '-mn -WD' options and listed the code files.
When that failed, I fired up the IDDE and set up a Win32 DLL project.  In both
cases, I get the same giant list of errors involved being unable to export
symbols.

I am sure that I'm just doing something foolish.  In particular, I have not
added GDI32.lib and other system libraries that I need to build the project.  I
don't directly see how that would cause the "cannot export" errors, but I
certainly see how it would cause the "undefined" errors.

Here is an abbreviated example of the output.  I cut out most of my member
functions, because they were boring.  I left the "undefined" errors for the
various library functions alone, in case those were somehow useful.  Any
suggestions would be greatly appreciated.
Aug 25 2003