View previous topic :: View next topic |
Author |
Message |
timfang
Joined: 06 Jan 2007 Posts: 2
|
Posted: Sat Jan 06, 2007 9:13 pm Post subject: Need help on my first d3d9 application |
|
|
Hello!
I get a link error on my first d3d9 application:
C:\D\TryD3D9>dmd myd3dapp.d -I\d\dmd\ext
C:\D\dmd\bin\..\..\dm\bin\link.exe myd3dapp,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
myd3dapp.obj(myd3dapp)
Error 42: Symbol Undefined _Direct3DCreate9@4
--- errorlevel 1
how can I deal with this error? I tried to link d3d9.lib from the dxsdk, but failedit isnt a valid lib!
One more question, where can I find d3dx9 binding files?
Thanks a lot! |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Sun Mar 04, 2007 9:30 am Post subject: |
|
|
I solved it by adding this code
version(build)
{
pragma(build_def, "IMPORTS");
pragma(build_def, "_Direct3DCreate9@4=d3d9.Direct3DCreate9");
} |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Extrawurst
Joined: 14 Mar 2007 Posts: 41
|
Posted: Sun May 18, 2008 8:42 am Post subject: why ? |
|
|
why is it that doing this ( see doob's post ) is necessary? at least all external methods in d3d9.d are only reachable with that workaround ;(
the mehtods are: (in d3d9.d)
Direct3DCreate9(UINT SDKVersion);
Direct3DCreate9Ex(UINT SDKVersion, LPDIRECT3D9EX*);
D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName );
D3DPERF_EndEvent();
D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName );
D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName );
D3DPERF_QueryRepeatFrame();
D3DPERF_SetOptions( DWORD dwOptions );
D3DPERF_GetStatus(); |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
wyverex
Joined: 09 Feb 2008 Posts: 2
|
Posted: Thu Jul 17, 2008 2:00 pm Post subject: |
|
|
Need 2 tools
linkdef
http://www.dprogramming.com/linkdef.php
implib
http://www.digitalmars.com/ctg/implib.html
I wrote a simple Dx9 app
Code: |
module dx;
pragma(lib, "gdi32.lib");
pragma(lib, "d3d9.lib");
pragma(lib, "d3dx9.lib");
//DirectX/Windows stuff
import win32.windows,
win32.directx.d3d9,
win32.directx.d3dx9;
void main()
{
auto hInstance = GetModuleHandle(null);
auto blackBrush = cast(HBRUSH)GetStockObject(BLACK_BRUSH);
WNDCLASSEX wc = {WNDCLASSEX.sizeof, CS_HREDRAW | CS_VREDRAW, &MsgProc, 0, 0, hInstance,
null, null, blackBrush, null, "WindowClass", null};
RegisterClassEx(&wc);
scope(exit) UnregisterClass("WindowClass", hInstance);
auto hWnd = CreateWindowEx(WS_EX_TOPMOST, "WindowClass", "DirectX from D!", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 800,600, null, null, hInstance, null);
assert(hWnd !is null);
ShowWindow(hWnd, SW_NORMAL);
//load DX stuff here
auto D3D = Direct3DCreate9(D3D_SDK_VERSION);
assert(D3D !is null);
scope(exit)D3D.Release;
D3DPRESENT_PARAMETERS dpp;
dpp.Windowed = true;
dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
dpp.hDeviceWindow = hWnd;
LPDIRECT3DDEVICE9 device;
D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dpp, &device);
assert(device !is null);
scope(exit) device.Release;
MSG msg;
while(true)
{
if(PeekMessage(&msg, null, 0, 0 , PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}else
{
//game logic Here
device.Clear(0,null, D3DCLEAR_TARGET, 0x0000FF, 1.0,0);
device.BeginScene();
device.EndScene();
device.Present(null,null,null,null);
Sleep(17);
}
}
}
extern(Windows)
int MsgProc(HWND hWnd, uint msg, uint wParam, int lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
}
|
dmd dx.d gives me
Symbol Undefined _Direct3DCreate9@4
--- errorlevel 1
so I wrote a bat file to make the required libs for me
Code: |
cls
del *.lib *.obj
dmd dx.d | linkdef d3d9
implib d3d9.lib d3d9.def
dmd dx.d d3d9.lib | linkdef d3dx9_38
implib d3dx9.lib d3dx9_38.def
dmd dx.exe
|
So when I get the error I just run the bat file it makes the new libs for me
else just run dmd dx.d
(Note: Change d3dx9_38 to what ever version your running, 38 is 2008 June SDK)
-Wyverex |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|