🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools
Article #956

BC++ 4.5 building DLL w/OWL linked w/static libs

#956
From: James Powers
Date: Mon, 16 Oct 1995 20:46
95 lines
4482 bytes
I am trying to build a DLL that contains OWL functions and is linked
with the static OWL libraries (so that my DLL does not require
OWL250.DLL). Compiling and linking with the import library for
OWL250.DLL works fine, but I have tried several different approaches
to link with the static libraries (owlwlu.lib I believe) without
success.  Has anyone successfully done this?  I would like to know
what libraries and compile switches you used.

Here's what I have tried (Help! I have wasted 2 days on this already).
Sorry for the length, but I wanted to supply enough information to
hopefully get a definitive answer.

I started with the dllhello example
(\bc45\examples\owl\owapi\dllhello).
I used the TargetExpert (for calldll.exe and dllhello.dll) and changed
the Standard Libraries from Dynamic to Static. I then tried to build
dllhello.dll and received the following linker errors:

Compiling DLLHELLO.CPP:
Linking dllhello.dll:
Linker Warning: No module definition file specified: using defaults
Linker Error: Undefined symbol TWindow::TWindow(TWindow far*,const
char far*,TModule far*) in module DLLHELLO.CPP
Linker Error: Undefined symbol TWindow::TWindow(const HWND__
near*,TModule far*) in module DLLHELLO.CPP
Linker Error: Undefined symbol TWindow::~TWindow() in module
DLLHELLO.CPP
Linker Error: Undefined symbol TStreamableBase::~TStreamableBase() in
module DLLHELLO.CPP

I then produced the makefile to see if I could figure out what was
going on. It appeard to me that the IDE modified the libraries to use,
but didn't adjust the compiler switches, i.e., it still used
-D_OWLDLL;_RTLDLL. Here's a snippet from the resultant makefile.

CLATW16_calldlldexe =  -H=..\..\..\..\LIB\OWLWI.CSM -ml -WS
-H"owl\owlpch.h"
CEAT_calldlldexe = $(CLATW16_calldlldexe)
CNIEAT_calldlldexe = -I..\..\..\..\INCLUDE
-D_OWLALLPCH;_RTLDLL;_BIDSDLL;_OWLDLL;_OWLPCH;
CLATW16_dllhellodlib =  -H=..\..\..\..\LIB\OWLDLL.CSM -ml -WD
-H"owl\owlpch.h"
CEAT_dllhellodlib = $(CEAT_calldlldexe) $(CLATW16_dllhellodlib)
CNIEAT_dllhellodlib = -I..\..\..\..\INCLUDE
-D_OWLALLPCH;_RTLDLL;_BIDSDLL;_OWLDLL;_OWLPCH;

dllhello.obj :  dllhello.cpp
  $(BCC)   -c @&&|
 $(CEAT_dllhellodlib) $(CNIEAT_dllhellodlib) -o$@ dllhello.cpp

So, I tweaked the makefile to use what I believe are the proper
compile switches:

CNIEAT_dllhellodlib = -I..\..\..\..\INCLUDE
-D_OWLALLPCH;USERDLL;_OWLPCH;

It successfully built dllhello.dll, but when it linked calldll.exe I
received two warnings:

Turbo Link  Version 7.00 Copyright (c) 1987, 1994 Borland
International
Warning: Attempt to export non-public symbol initwndproc(const hwnd__
near*,unsigned int,unsigned int,long)
Warning: Attempt to export non-public symbol stdwndproc(const hwnd__
near*,unsigned int,unsigned int,long)

dllhello.dll exported these two functions. Since they were only
warnings, I figured I might as well try run calldll.exe When I did I
received a GPF in dllhello.dll. I have tried several things since, but
have still have not been able to get calldll.exe to work when dllhello
is linked with that static libraries.

(I tried creating an IMPORTS section in my calldll.def file and not
linking with the dllhello import lib, but I get an call to undefined
dynalink message.

I tried removing the _export keyword from initwndproc and stdwndproc
and rebuilding owlwlu.lib, but that GPFed also)

[I have had no problems with dllhello/calldll when linked to the OWL
DLLs].

BTW, tables 1.2, 1.5 and 1.6 in the ObjectWindows Programmer's
Reference are confusing.  For example, table 1.2 owlwiu.lib really the
16-bit large static for user .DLL or is owlwlu.lib really the 16-bit
import static for user .DLL (I think they have them switched).  Also,
I haven't quite figured out what tables 1.5 and 1.6 are trying to
convey.  I interpreted the last row of table 1.5 to say, If you are
building a 16-bit dll and with a ObjectWindows static library, use
-DUSERDLL and link with OWLWLU.LIB.

--
James Powers
jkpowers@cts.com
james.powers@forteinc.com
Technical Details
Message-ID: <45ugbe$26r@news2.cts.com>
Path: arc1-ca.pugleaf.net!newshub.cts.com!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newshub.cts.com!usenet
From: jkpowers@cts.com (James Powers)
Newsgroups: comp.os.ms-windows.programmer.tools,comp.lang.c++,comp.os.ms-windows.programmer.tools.owl
Subject: BC++ 4.5 building DLL w/OWL linked w/static libs
Date: Mon, 16 Oct 1995 20:46:32 GMT
Organization: J K Powers
Message-ID: <45ugbe$26r@news2.cts.com>
NNTP-Posting-Host: jkpowers.cts.com
X-Newsreader: Forte Agent .99b.111