linker: undefined symbol when an interface is derived from.
    Neal Alexander 
    wqeqweuqy at hotmail.com
       
    Mon Feb 26 09:00:55 PST 2007
    
    
  
The IDirect3D8 interface works fine if its used opaquely with the 
various directx routines; but when the interface is used to make a class 
that implements it, or in this case wraps it, the linker cant find the 
IDirect3D8 interface symbol.
Scope issues or compiler bug?
 > dmd file2.d file1.d uuid.lib d3d8.lib
file2.obj(dx8_wrapper)
  Error 42: Symbol Undefined _D4d3d810IDirect3D811__InterfaceZ
---------------------------------------------------------------------
d3d8.d
---------------------------------------------------------------------
// ... snip ...
extern (Windows):
interface IDirect3D8 : public IUnknown
{
     /*** IUnknown methods ***/
     //HRESULT QueryInterface(IID*, void**);
     //ULONG AddRef();
     //ULONG Release();
     // ... snip ...
     HRESULT CreateDevice(UINT,D3DDEVTYPE,HWND,DWORD,
                          D3DPRESENT_PARAMETERS*,IDirect3DDevice8*);
}
// ...
---------------------------------------------------------------------
file1.d
---------------------------------------------------------------------
import d3d8;
extern (Windows):
class dx8_wrapper : ComObject, public IDirect3D8
{
     // ... snip ...
     HRESULT CreateDevice(
         UINT adapter,
         D3DDEVTYPE type,
         HWND window,
         DWORD flags,
         D3DPRESENT_PARAMETERS * pp,
         IDirect3DDevice8      * result)
     {
         HRESULT ret;
	ret = d3d.CreateDevice(adapter, type,
                                window, flags, pp, &device);
         *result = device;
         return ret;
     }
     this(IDirect3D8 base){ d3d = base; }
     IDirect3D8       d3d;
     IDirect3DDevice8 device;
}
    
    
More information about the Digitalmars-d-learn
mailing list