Undefined function, even though imported

Loopback elliott.darfink at gmail.com
Mon Jun 13 17:43:55 PDT 2011


Thanks for all the answers! Seems like rdmd did the trick.
I don't see why this isn't built in to dmd though, or does it cause
overhead when you are using rdmd? Benefits, Drawbacks?

I've also stumbled upon an additional error with the win32 DirectX
bindings, but this seems D related actually. When I compile any code
at all (with rdmd) which imports win32.directx.d3d9 and uses the
function Direct3DCreate9, the linker issues this warning:

Error 42: Symbol Undefined _Direct3DCreate9 at 4

It is shown even though I'm using rdmd and I have linked to d3d9.lib
(other functions like CreateDevice and Present still works though).
To solve this error, I did some searching and it seems like I'm not
the first one with this problem. I got 2 hits:

http://www.digitalmars.com/d/archives/digitalmars/D/learn/1475.html
http://www.dsource.org/forums/viewtopic.php?p=13971&sid=d43d05620f0c3a30758a326394ac2e26

Both of these links says that the problem is solved by adding
_Direct3DCreate9 to imports. I've tried to do this by linking to a
.def file with this content (without success, same error is still
issued).

EXETYPE NT
SUBSYSTEM WINDOWS

IMPORTS
_Direct3DCreate9 at 4=d3d9.Direct3DCreate9

I also tried this code but pragma build_def seems deprecated:

pragma(build_def, "IMPORTS");
pragma(build_def, "_Direct3DCreate9 at 4=d3d9.Direct3DCreate9");

So am I doing something wrong with the def file or am I perhaps
supposed to use another pragma?

Thanks in advance!


More information about the Digitalmars-d-learn mailing list