Home Forums Programming Linking dll to C++ at runtime.

Welcome to our forums. These forums were active from 2003-2014. We have now decided to close them down, but will leave them here as an archive.

Remember you can send us feedback, news, jobs and content ideas by clicking here.

If you're really stuck for time, email news@gamedevelopers.ie.

You can also follow us on Twitter @gamedev_ie 

 

 

This topic contains 3 replies, has 2 voices, and was last updated by  y2kprawn 11 years, 8 months ago.

  • Author
    Posts
  • #5129

    y2kprawn
    Participant

    Hi All,

    I am trying to link to a dll in c++ when I run my application. I am using a database called SQLITE. To access it I want to use SQLPI++. There is a DLL with it called libsqlapi.dll. Instead of having to install it every time i go to a deployment computer I want to “register” the DLL for use by my C++ application (Asteroids Game) at runtime.
    Does anyone know a way fo doing this, prefereable for any DLL. I am sure it is used in game programming, instead of having to create a specific installer for my game :(
    Any insight would be greatly appreciated.
    I am using BloodshedDEV C++, but also have access to Visual Studio 6 is anyone knows links to code examples, but im not worried about Environment specific issues,

    Rob

  • #30021

    peter_b
    Participant

    Hi All,

    I am trying to link to a dll in c++ when I run my application. I am using a database called SQLITE. To access it I want to use SQLPI++. There is a DLL with it called libsqlapi.dll. Instead of having to install it every time i go to a deployment computer I want to “register” the DLL for use by my C++ application (Asteroids Game) at runtime.
    Does anyone know a way fo doing this, prefereable for any DLL. I am sure it is used in game programming, instead of having to create a specific installer for my game :(
    Any insight would be greatly appreciated.
    I am using BloodshedDEV C++, but also have access to Visual Studio 6 is anyone knows links to code examples, but im not worried about Environment specific issues,

    Rob[/quote:e21e991c33]

    Think what you need is LoadLibrary.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp

    Basically you provide it with the path to your where your .dll resides (game directory). Do this at the very beginning of you game code and the functions within it should be exposed to your code. Hope that helps.

    Peter

  • #30025

    y2kprawn
    Participant

    Sweet man. Ill give this a shot and let you know the outcome. thanks

  • #30404

    y2kprawn
    Participant

    Cheers , that worked a treat, no more fiddly code.

The forum ‘Programming’ is closed to new topics and replies.