Jump to content
  • Advertisement
Sign in to follow this  
nullsquared

No .lib only .dll?

This topic is 4446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

//#include "Code_Log.hpp"
//#include "Code_Pointer.hpp"
//#include "Code_Script.hpp"
#include "Code_Dll.hpp"

#include <iostream>
using namespace std;

int main() {
    Code::DllLibrary Lib;

    Lib.LoadLibrary("SDL.dll");

    if (!Lib) {
        cout << "Couldn't load SDL.dll...";
        return 1;
    }

    void (*pSDL_Delay)(unsigned milliseconds) = NULL;
    pSDL_Delay = Lib.LoadFunction<void (*)(unsigned)> (
        "SDL_Delay"
    );

    if (!pSDL_Delay) {
        cout << "Couldn't load SDL_Delay...";
        return 1;
    }

    for (bool Done = false; !Done;) {
        cout << "How many milliseconds do you want to delay: ";

        unsigned milli = 0;
        cin >> milli;
        cout << "\n";

        pSDL_Delay(milli);
    }
}

I made a little class to load dlls and dll functions.. Nothing fancy, only the basics (just basically load a function...). Now I'm wondering, the SDL_Delay() works fine without linking or anything, just the pointer. Now, does this mean that I can use everything like this? SDL_Init, SDL_Quit, everything? And now come in the structures... Since I won't have them from SDL does that mean that I can make my on struct (completely identicle) and pass it into SDL functions by casting? Just wondering. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Yup, you can use it all like that. Thats why DLL's are so powerfull, and why COM works. structs, yeah, unfortunately, you will have to redefine them by hand. Sorry...

Share this post


Link to post
Share on other sites
Quote:
Original post by KaptainKomunist
Yup, you can use it all like that. Thats why DLL's are so powerfull, and why COM works. structs, yeah, unfortunately, you will have to redefine them by hand. Sorry...


Cool stuff! This is sooo interesting!

Thank you. I was more on the side of "will it work" rather than "i will do it" anyways.. It's just that I'm wondering.

To teh opengl gurus, isn't this basically the way to use opengl greater than v.1.1?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!