News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DIRECTX9 errors at link time

Started by ToutEnMasm, October 04, 2007, 09:25:04 AM

Previous topic - Next topic

ToutEnMasm

Hello,
I am translating "matrices" from the sdk directx9 for masm.
Compiled time is OK , but at link time I have this errors
I have added the same libraries than in the c++ project.
d3dxof.lib dxguid.lib d3dx9dt.lib d3d9.lib winmm.lib user32.lib advapi32.lib

What is the problem ?
                          ToutEnMasm


Quote
3dx9.lib(float162.obj) : error LNK2001: unresolved external symbol __fltused
d3dx9.lib(d3dxmath.obj) : error LNK2001: unresolved external symbol __CIacos
d3dx9.lib(d3dxmath.obj) : error LNK2001: unresolved external symbol __finite
d3dx9.lib(d3dxmath.obj) : error LNK2001: unresolved external symbol __ftol
d3dx9.lib(psgpmesh.obj) : error LNK2001: unresolved external symbol __ftol
d3dx9.lib(cpudetect.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler
d3dx9.lib(ssefasttable.obj) : error LNK2001: unresolved external symbol __except_list
d3dx9.lib(cpudetect.obj) : error LNK2001: unresolved external symbol __EH_prolog
d3dx9.lib(ssefasttable.obj) : error LNK2001: unresolved external symbol __except_handler3

Tedd

The C++ libs must have extra dependencies which are not found because you're not linking in the C++ startup modules.
I would guess it's d3dx9dt that's doing most of it. If you link with the extra required objects then the problem will go away, but you'll have a nice code-bloat :bdg
Probably best to create your own dependency-free libs - which is a lot of work and won't include some of the extra code support provided.
No snowflake in an avalanche feels responsible.

ToutEnMasm


I am afraid to understand you.
You think that it is a too much difficult to do ?... (it's a test to see if it is so hard)
Thanks anyway.

ToutEnMasm


I was thinking at another solution.Linking dynamically to the dll of directx.
The list of dll loaded by the vc++ sample isn't very big.

Quote
ModLoad: 7c800000 7c905000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 4fcf0000 4fe96000   C:\WINDOWS\system32\d3d9.dll
ModLoad: 6de60000 6de66000   C:\WINDOWS\system32\d3d8thk.dll
ModLoad: 77ef0000 77f37000   C:\WINDOWS\system32\GDI32.dll
ModLoad: 7e390000 7e420000   C:\WINDOWS\system32\USER32.dll
ModLoad: 77be0000 77c38000   C:\WINDOWS\system32\msvcrt.dll
ModLoad: 77da0000 77e4c000   C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e50000 77ee1000   C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77bd0000 77bd8000   C:\WINDOWS\system32\VERSION.dll
ModLoad: 76ae0000 76b0f000   C:\WINDOWS\system32\WINMM.dll
ModLoad: 76320000 7633d000   C:\WINDOWS\system32\IMM32.DLL
ModLoad: 10000000 10036000   C:\WINDOWS\system32\sockspy.dll
ModLoad: 5b090000 5b0c8000   C:\WINDOWS\system32\uxtheme.dll
ModLoad: 74690000 746db000   C:\WINDOWS\system32\MSCTF.dll
ModLoad: 75140000 7516e000   C:\WINDOWS\system32\msctfime.ime
ModLoad: 774a0000 775dd000   C:\WINDOWS\system32\ole32.dll

Seems that there is only d3d9.dll and d3d8thk.dll in use.
I have the prototypes for masm.I need just a tool to extract the exported name of the dll.I have a tool that can generate the declarations with that.
Perhaps he could work ?







ToutEnMasm

Hello,
Found some of the definitions in the msvcrt.lib (masm).
I have only (?) two symbols needed
Directx link with the crt library,some sources of it are in the windows SDK %SDK%\src\crt.
_fltused is a simple dword , define in dllsup.c.
_except_list is also part of the CRT library ,but i have not found it except here.
http://www.koders.com/cpp/fidB23900CB31E5017620C69CFE0C7B1076C5946C1E.aspx

Something is strange the _fltused isn't accessible by "extern" in the c++ project ???

ToutEnMasm

Hello,
Solved , after lost my time with the crt library and his source code in c,and some errors like that.
Quote
Access violation in  FS:_except_list
I finally add the "includelib \PROGRA~1\MICROS~3\VC\lib\libcmt.lib" and the masm msvcrt.lib.
result his
Quote
debugging information corrupt; recompile module
                               :green

Just need to compile without /DEBUG information.If someone know the needed option for this ,let's me know.
It's only different kind of debug format that disturb the linker.
There is also the "start:    end start" to rename "main:            end main"







ToutEnMasm

#6
Hello,
That"s not a finished answer,other problems can occure at run.
There is two method:
First:
Quote
includelib \PROGRA~1\MICROS~3\VC\lib\libcmt.lib     ;Vc 8 express
No more things is needed

Two:
Quote
includelib \PROGRA~1\MICROS~3\VC\lib\MSVCRT.LIB ;msvcrt.lib vc8 express
This second method need a manifest
http://www.codeproject.com/cpp/vcredists_x86.asp#Shared_CRTs
With masm,the manifest must be in the resource (extern don't work)
resource file
Quote
#define RT_MANIFEST 24
#define APP_MANIFEST 1
APP_MANIFEST RT_MANIFEST  DISCARDABLE "Microsoft.VC80.CRT.manifest"
The manifest need no change
Quote
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
                                 manifestVersion="1.0">
  <noInheritable/>
  <assemblyIdentity
    type="win32"
    name="Microsoft.VC80.CRT"
    version="8.0.50608.0"
    processorArchitecture="x86"
    publicKeyToken="1fc8b3b9a1e18e3b" />
  <file name="msvcr80.dll"/>
  <file name="msvcp80.dll"/>
  <file name="msvcm80.dll"/>
</assembly>
Path to find the dll
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
copy the dll in the directory of the executable

Other things
The linker of VC ++ can generate manifest (not documented)
Quote
/MANIFEST /MANIFESTFILE:"matrices.exe.intermediate.manifest"

The bin directory of vc++ and windows SDK have two differents mt.exe (tools for manifest)

What is the difference between the two methods,I don't know

++++++++++++++++ This one is pretty good +++++++++++++++++++++++++
If you have vc++ 8 express ,he allow you to use the msvcrt.lib
includelib \PROGRA~1\MICROS~3\VC\lib\MSVCRT.LIB without move the 3 dll that you have

Quote
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.762" processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.ATL" version="8.0.50727.762" processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50608.0" processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>