Thread: Loading dll with LoadLibrary

  1. #1
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476

    Loading dll with LoadLibrary

    Hi, I've been trying to load a dll using LoadLibrary. But the call to load that library returned a NULL. And when I run GetLastError, it showed me this error message:

    ‎"This application has failed to start because the application
    configuration is incorrect. Reinstalling the application may fix this
    problem."
    I've installed the vcredist and copied the whole content of Microsoft.VC80.CRT to the binary folder since I thought maybe it was because of the SxS issue. I guess I was wrong.

    BTW, does LoadLibrary always search for DLLMain? The one I tried to load doesn't have DLLMain.

    What went wrong here? Thanks in advance.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by g4j31a5 View Post
    Hi, I've been trying to load a dll using LoadLibrary. But the call to load that library returned a NULL. And when I run GetLastError, it showed me this error message:



    I've installed the vcredist and copied the whole content of Microsoft.VC80.CRT to the binary folder since I thought maybe it was because of the SxS issue. I guess I was wrong.

    BTW, does LoadLibrary always search for DLLMain? The one I tried to load doesn't have DLLMain.

    What went wrong here? Thanks in advance.
    All DLL's must have an entry point, although it needn't be named "DLLMain" (from the loader's perspective, at least - most compiler vendors do use the "DLLMain" identifier, by default, and overriding that generally requires the use of special switches).
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Losing reference between dlls
    By g4j31a5 in forum Windows Programming
    Replies: 7
    Last Post: 05-19-2010, 02:28 AM
  2. Dll Loading Twice?
    By pobri19 in forum Windows Programming
    Replies: 2
    Last Post: 11-25-2009, 11:26 AM
  3. Loading a DLL that is not in the same directory as the executable
    By starcatcher in forum Windows Programming
    Replies: 10
    Last Post: 12-13-2008, 07:05 AM
  4. Replies: 8
    Last Post: 12-01-2008, 10:09 AM
  5. Loading a DLL at runtime
    By filler_bunny in forum Windows Programming
    Replies: 9
    Last Post: 02-23-2003, 08:03 AM