hi i have the following code below that has been giving me a headach
whenever i try to compile it as MTD(Multi-Threaded Debug) instead of the usual MDD(Multi-Threaded Debug Dll)

it fails at the line stated below.

i just dont get it how it would work on MDD and not MTD.

also both the dll caller class and the dll are being compiled in the same way.

thanks for you help


// dll header
Code:
#ifndef __MYCLASS_H__
#define __MYCLASS_H__

#include <iostream>
#include <vector>
#include "MyInterface.h"

using namespace std;

class MyClass: public MyInterface
{
public:

    virtual void Hello();

	void Add(vector<MyInterface*> &vBase2);
  
};

extern "C" __declspec(dllexport) void createMyClass(vector<MyInterface*> &vBase2);

extern "C" __declspec(dllexport) void Add();

#endif
// dll cpp
Code:
#include "myclass.h"

extern "C" __declspec(dllexport)

	void createMyClass(vector<MyInterface*> &vBase2)
	{
	   MyClass* mycl = new MyClass;

	   cout << "yeaaa wopwop" << endl;

	   cout << vBase2.size() << endl;

	   mycl->Add(vBase2);

	}

void MyClass::Hello(){

		cout << "worked" << endl;

}

 void MyClass::Add(vector<MyInterface*> &vBase2) {

		cout << "Add" << endl;
		system("PAUSE");

		 vBase2.push_back(this);// FAILS HERE
	}
// calls dll
Code:
#include <Windows.h>
#include <iostream>
#include <vector>

#include "MyInterface.h"

using namespace std;

vector<MyInterface*> vBase2;

typedef void (*cfunc)(vector<MyInterface*> &vBase2);

 cfunc createMyClass;

 void main() {
   
       HINSTANCE hLib = LoadLibrary("myclass.dll");


       if(hLib==NULL) {

            cout << "Unable to load library!" << endl;
            system("PAUSE");
            return;
       }

	   createMyClass = (cfunc)GetProcAddress((HMODULE)hLib, "createMyClass");

       if(createMyClass == NULL) {

            cout << "Unable to load function(s)." << endl;
            FreeLibrary((HMODULE)hLib);
            return;
       }

	createMyClass(vBase2);

	cout << "It showuld work" << endl;
	

	vBase2.at(0)->Hello();

       FreeLibrary((HMODULE)hLib);

       system("PAUSE");
 }

//Interface
Code:
#pragma once

// MyInterface.h
class MyInterface
{
public:
  virtual ~MyInterface() { }
  virtual void Hello() = 0;
};