linker error using latest branch

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

linker error using latest branch

Post by Seven »

I delay load the DLL files in order to have time to copy them from the build directory before use.

all was fine until I added an animatedmeshscenenode and began getting this linker error

LINK : fatal error LNK1194: cannot delay-load 'Irrlicht64.dll' due to import of data symbol '"__declspec(dllimport) unsigned int irr::video::MATERIAL_MAX_TEXTURES_USED" (__imp_?MATERIAL_MAX_TEXTURES_USED@video@irr@@3IA)'; link without /DELAYLOAD:Irrlicht64.dll

Code: Select all

 
    //! By default this is identical to MATERIAL_MAX_TEXTURES
    /** Users can modify this value if they are certain they don't need all
        available textures per material in their application. For example if you
        never need more than 2 textures per material you can set this to 2.
 
        We (mostly) avoid dynamic memory in SMaterial, so the extra memory
        will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
        material comparisons and assignments can be faster. Also several other
        places in the engine can be faster when reducing this value to the limit
        you need.
 
        NOTE: This should only be changed once and before any call to createDevice.
        NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_.
        NOTE: Going below 4 is usually not worth it.
    */
    IRRLICHT_API extern u32 MATERIAL_MAX_TEXTURES_USED;
 
researching, I find that this is defined as dllexport

Code: Select all

 
// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the
// Irrlicht build, *and* in the user application, before #including <irrlicht.h>
#ifndef _IRR_STATIC_LIB_
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)       <---------------------------------------- highlited
#else
#define IRRLICHT_API __declspec(dllimport)       <---------------------------------------- NOT highlited???
#endif // IRRLICHT_EXPORT
#else
#define IRRLICHT_API
#endif // _IRR_STATIC_LIB_
 

and that IRRLICHT_EXPORTS is defined in the property pages of the build
WIN32;WIN64;_DEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)



any ideas on why the linker would see this as dllimport instead of export? or why it would appear only after adding an animatedmeshscenenode?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: linker error using latest branch

Post by CuteAlien »

dllimport sounds correct in your application (export for dll and import for you app).
I never worked with the delay loading. It seems import of data can't be handled that way - maybe that is the problem. Thought not sure why it worked then before as that was not the first variable marked with IRRLICHT_API. Which Irrlicht version did you use before?
As a workaround to test if that is the only problem you could try making it const.
So replace "IRRLICHT_API extern" by "const" and remove the definition in Irrlicht.cpp.

As for why it fails at that specific point - I guess that's when the dll is loaded? Maybe first Irrlicht function you call?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: linker error using latest branch

Post by Seven »

I am certain it is in my setup. I have a complicated method for loading DLL files since PhysX and IrrKlang don't name their DLL files according to the build.
I did change all of the Irrlicht naming so that I can just elave all 4 (32, 32_debug, 64, 64_debug) in the exe directory so for now now issues.

thanks!
Post Reply