Click here to Skip to main content
13,350,861 members (52,671 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 26 Jan 2012

Link order and mixed-mode DLLs

, 26 Jan 2012
Rate this:
Please Sign up or sign in to vote.
When linking a mixture of mixed-mode and unmanaged DLLs to an unmanaged C++ executable, the link order can affect how the program runs.
I recently added a mixed-mode C++/CLI DLL to an existing unmanaged C++ project which also included two unmanaged C++ DLLs, and found that the application file would crash very early on, before it had even reached any user code.

After pulling out what little remains of my hair, I found that the order the DLLs' .lib files are linked to the executable affects whether or not it will crash.

Basically, if you have an unmanaged and a mixed-mode DLL linked to the same executable, the mixed-mode DLL's .lib file must be linked first, or the application will crash.

Just a short tip, but hopefully it'll be useful to someone!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralThis is new fact to me. Did you got the reason why it is beh... Pin
Lakamraju Raghuram26-Jan-12 5:31
memberLakamraju Raghuram26-Jan-12 5:31 
This is new fact to me.
Did you got the reason why it is behaving so?
It would be great if you can explain the reason also.
GeneralRe: It might be because the link order affects the order in whic... Pin
viaducting26-Jan-12 5:41
memberviaducting26-Jan-12 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 26 Jan 2012
Article Copyright 2012 by hairy_hats
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid