Hello developers,
I have been playing around with C++ and wxWidgets for a little time now and I think it is time to make a little useful program I am planning to make a CD ripper and Encoder (re-inverting the wheel purposely for learning) and I plan to use CDRip.dll or Akrip32.dll as rippers and Lame as Encoder. Alot of words anyway here comes a question:

1. How do I load dll functions in My C++ program and use their function

2. Any good example on CD ripping or Encoding?

I'm trying to follow the tutorial here but it is for VB

Hope to benefit from your experiences guys :)

You won't be reinventing the wheel if your using dlls from other software to make it. It will just basically be organizing and making your own GUI. If you really want to "Reinvent the Wheel" then make EVERYTHING yourself.
But it will be pretty hard to use the dlls unless you have a lib.

Hehehe, I meant that others have done this too ;)
Anyway ho do I go about it?

I think I need someone to help me to get up and running with DLLs.
I have googled for Tutorial, but I find difficult to follow much of tutorials. They just do a lot in advanced way and I'm just a new bee :)

after some roaming around MSDN library, I got some light on DLLs issues. Then I tried to make DLL and call it in simple app. But the call produces weird strange results. What is wrong with the code?

Also when I make new DLL project in code::blocks, code::blocks gives a code by default. I don't understand most of IFDEFs it writes!

My DLL Code is:

#ifndef __MAIN_H__
#define __MAIN_H__

#include <windows.h>

/*  To use this exported function of dll, include this header
 *  in your project.

#ifdef BUILD_DLL
    #define DLL_EXPORT __declspec(dllexport)
    #define DLL_EXPORT __declspec(dllimport)

#ifdef __cplusplus
extern "C"

DLL_EXPORT double Add(double a, double b);

#ifdef __cplusplus

#endif // __MAIN_H__
#include "main.h"
# include<iostream>
using namespace std;

// a sample exported function
DLL_EXPORT double Add(double a, double b)
    cout<<"DLL got called!"<<endl;

Application that call the DLL

// MyExecRefsDll.cpp
// compile with: /EHsc /link MathFuncsDll.lib

#include <iostream>

#include "windows.h"

using namespace std;
//dll stuffs
typedef double (*AddFunc)(int a, int b);

int main()
    //declare the pointers to DLL functions
    AddFunc Add;
    HINSTANCE ourlib = LoadLibrary("math.dll");
    if (ourlib==NULL)

        Add = (AddFunc)GetProcAddress(ourlib, "Add");
        double a = 7.4;
        double b = 99.6;

        cout << "a + b = " <<
            Add(a, b) << endl;
        /*cout << "a - b = " <<
            MathFuncs::MyMathFuncs::Subtract(a, b) << endl;
        cout << "a * b = " <<
            MathFuncs::MyMathFuncs::Multiply(a, b) << endl;
        cout << "a / b = " <<
            MathFuncs::MyMathFuncs::Divide(a, b) << endl; */
        return 0;

Since there is no answer, I think I have to open separate thread for DLL Issues.
Thank All!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.