Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Trouble linking with particular libs

Trouble linking with particular libs

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiohelpquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AceCoolie
    wrote on last edited by
    #1

    Hi. I'm having trouble linking with particular libs. I have an OGL ES app that needs functions in libGLES_CM.dll. I have two versions of this dll and the corrisponding libs. The first I got from the Khronos site. This version works. The second, I'm building from source. This version doesn't. The problem is unresolved externals. If I look at the lib files in Visual studio, the function names seem to be decorated differently. In the Khronos version, it looks like this... __imp__glTranslatex._glTranslatex In the version I build from source, it looks like this... __imp__glTranslatex@12._glTranslatex@12 What do I need to do to my app or visual studio to be able to link to the second version that I build from source? Thanks!

    A 1 Reply Last reply
    0
    • A AceCoolie

      Hi. I'm having trouble linking with particular libs. I have an OGL ES app that needs functions in libGLES_CM.dll. I have two versions of this dll and the corrisponding libs. The first I got from the Khronos site. This version works. The second, I'm building from source. This version doesn't. The problem is unresolved externals. If I look at the lib files in Visual studio, the function names seem to be decorated differently. In the Khronos version, it looks like this... __imp__glTranslatex._glTranslatex In the version I build from source, it looks like this... __imp__glTranslatex@12._glTranslatex@12 What do I need to do to my app or visual studio to be able to link to the second version that I build from source? Thanks!

      A Offline
      A Offline
      alunw
      wrote on last edited by
      #2

      I'm not familiar with the particular libraries or DLLs are using, so I apologise if my comments below are obvious or not helpful. I think the @12 means your function is being compiled as a __stdcall function. If the function does not have a calling convention specified (e.g. __fastcall or __cdecl) or some equivalent macro (e.g. WINAPI) then your compile options may be selecting a different calling convention from the one intended. (Check for /Gz compile option and try using /Gr instead). I'd also check such things as your predefined macros (e.g. WIN32 _MSC_VER etc) and other -D options. If the code you are compiling is intended for multiple platforms things like calling conventions are likely to be very sensitive to this, because the code will be trying to cope with different compilers. Another possible cause of confusion is the method used to build the import library. You can get quite different results depending on whether you have a .DEF file or not, and whether you make use of the .EXP file or not. If you don't have a .DEF file, the linker will usually use your functions actual signature for the .LIB file, but if you have a .DEF file you may be able to remove the decoration. Personally I always use a .DEF file, and put NONAMES everywhere. It might be an idea to try to locate a makefile for the Khronos version.

      A 1 Reply Last reply
      0
      • A alunw

        I'm not familiar with the particular libraries or DLLs are using, so I apologise if my comments below are obvious or not helpful. I think the @12 means your function is being compiled as a __stdcall function. If the function does not have a calling convention specified (e.g. __fastcall or __cdecl) or some equivalent macro (e.g. WINAPI) then your compile options may be selecting a different calling convention from the one intended. (Check for /Gz compile option and try using /Gr instead). I'd also check such things as your predefined macros (e.g. WIN32 _MSC_VER etc) and other -D options. If the code you are compiling is intended for multiple platforms things like calling conventions are likely to be very sensitive to this, because the code will be trying to cope with different compilers. Another possible cause of confusion is the method used to build the import library. You can get quite different results depending on whether you have a .DEF file or not, and whether you make use of the .EXP file or not. If you don't have a .DEF file, the linker will usually use your functions actual signature for the .LIB file, but if you have a .DEF file you may be able to remove the decoration. Personally I always use a .DEF file, and put NONAMES everywhere. It might be an idea to try to locate a makefile for the Khronos version.

        A Offline
        A Offline
        AceCoolie
        wrote on last edited by
        #3

        Thanks. I added #define GL_APIENTRY __stdcall to my header file and it seems to have fixed the problem.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups