Thread overview
Some questions
Aug 28, 2005
Robert M. Münch
Aug 31, 2005
Walter
Sep 02, 2005
Robert M. Münch
Sep 02, 2005
Robert M. Münch
Sep 02, 2005
Walter
August 28, 2005
Hi, I'm trying to comile some C++ code and have some problems with the so loved "symbol undefined" errors. I have this class:

File: mk4.h
/// Used to get or set double precision values.
class c4_DoubleRef : public c4_Reference
{
public:
      /// Constructor
  c4_DoubleRef (const c4_Reference&);
      /// Get the value as floating point
  operator double () const;
      /// Set the value to the specified floating point
  c4_DoubleRef& operator= (double);
};

File: mk4.inl
/////////////////////////////////////////////////////////////////////////////
// c4_DoubleRef

d4_inline c4_DoubleRef::c4_DoubleRef (const c4_Reference& value_)
    : c4_Reference (value_)
{
}

File: viewx.cpp
c4_DoubleRef::operator double () const
{
  c4_Bytes result;
  if (!GetData(result))
    return 0;

  d4_assert(result.Size() == sizeof (double));
  return *(const double*) result.Contents();
}

c4_DoubleRef& c4_DoubleRef::operator= (double value_)
{
  SetData(c4_Bytes (&value_, sizeof value_));
  return *this;
}

And I get this error, when compiling some other code using the library where the above code belongs to:

mkstorage.obj(mkstorage)
 Error 42: Symbol Undefined ??Bc4_DoubleRef@@QBENXZ (operator double syscall c4_DoubleRef::(void )const )
mkstorage.obj(mkstorage)
 Error 42: Symbol Undefined ??4c4_DoubleRef@@QAEAAV0@N@Z (c4_DoubleRef &syscall c4_DoubleRef::=(double ))
OPTLINK : Warning 134: No Start Address

--- errorlevel 2

Any idea why those two unknown symbols show up? Somehow a reference to the shown signatures must be compiled but I have no idea where this happens. Could it be some implicit conversions? Any hint welcome.

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
August 31, 2005
I'd check to see that veiwx.obj is being linked in.


September 02, 2005
On Wed, 31 Aug 2005 06:35:04 +0200, Walter <newshound@digitalmars.com> wrote:

> I'd check to see that veiwx.obj is being linked in.

Ok, thanks. I checked to see if viewx.obj contains the functions at all. This is what "libunres -p viewx.obj" gives. (BTW: I didn't remember about libunres.exe)

...
??Bc4_BytesRef@@QBE?AVc4_Bytes@@XZ
??Bc4_IntRef@@QBEJXZ
??Bc4_StringRef@@QBAPBDXZ
??Bc4_ViewRef@@QBE?AVc4_View@@XZ
...

So, it seems, it's already not included in the viewx.obj file. How can this happen?

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
September 02, 2005
On Wed, 31 Aug 2005 06:35:04 +0200, Walter <newshound@digitalmars.com> wrote:

> I'd check to see that veiwx.obj is being linked in.

Ok, I got some more information, the problem is that:

_M_I86SM, M_I86SM
	Small memory model. Defined for -ms, -mx, -mp, -mf or -mn.

I'm using this line to compile my DLL:
	CFLAGS = -WD -mn -Ae -Ab -Dq4_WIN32 -Dq4_UNIV -Dq4_BOOL -Dq4_INLINE -Dq4_KITDLL -D_USRDLL

and this sets _M_I86SM. Is this correct? I thought Win32 always has a large (flat) memory model. I changed the #if part and now it works.

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
September 02, 2005
"Robert M. Münch" <robert.muench@robertmuench.de> wrote in message news:op.swg1irql3b5602@news.digitalmars.com...
> On Wed, 31 Aug 2005 06:35:04 +0200, Walter <newshound@digitalmars.com> wrote:
>
> > I'd check to see that veiwx.obj is being linked in.
>
> Ok, I got some more information, the problem is that:
>
> _M_I86SM, M_I86SM
> Small memory model. Defined for -ms, -mx, -mp, -mf or -mn.
>
> I'm using this line to compile my DLL:
> CFLAGS = -WD -mn -Ae -Ab -Dq4_WIN32 -Dq4_UNIV -Dq4_BOOL -Dq4_INLINE
> -Dq4_KITDLL -D_USRDLL
>
> and this sets _M_I86SM. Is this correct? I thought Win32 always has a
> large (flat) memory model.

True, but it is technically a "small" memory model.

> I changed the #if part and now it works.

I'm glad you got it working now.