REspawn

Hi,

Im making the move from c# to c++ and was wondering if anyone could point me in the right direction about this.

In c# i created a new .dll project and had all my code in it.

Then i created my actual .exe project and added the dll project as a refernece.

I was able to get that far with c++ but none of the classes the dll project owns show up in the exe project when i try an include or a new object creation.

Hopefully thats a clear enough picture of what im trying to do, if its not please say so and i will post a sample project or try and explain a bit better.

Thanks,

-Dave



Re: Visual C++ General Using a dll project in a windows forms project

TilakGopi

Hi,

u have to use the name space of the dll;

using namespace namespacename;

Now u'll be able to get the classes the dll.

That's it.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Using a dll project in a windows forms project

REspawn

Cheers for the reply TilakGopi it works to a certain extent.

I uploaded a sample project, it has the windows form project and a dll project with a sample class. I just need to be able to use the classes from the dll in the forms project.

Thanks for any help:

http://www.turnipfan.com/dev/sample_proj.rar,
-Dave





Re: Visual C++ General Using a dll project in a windows forms project

TilakGopi

Hi,

if u post ur mail id, i can change the modified code.I made few changes , i can describethem,

I don't have much knowledge on WindowsForms, but it's easy to do programming in it (almost like C#), so sometime i'm able to solve small problems.

But i can guess ,u can not not have a normal class in CLR/CLI support the class should be either ref class or value.For more info on this ,please see:

http://msdn2.microsoft.com/en-us/library/xey702bw(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/6w96b5h7(VS.80).aspx

I don't know ur need , why u have defined TestItem in DLLLib solution twice,creating confusion.

So,what i did is,i changed TestItem class in DLLLib to ref class type,added one variable,and it's get method,removed the  Testitem.h and TestItem.cpp files.built and added the reference to App.

Added

using namespace DLLLib;

using namespace App;

before main in App.cpp file.

Added

using namespace DLLLib;

in Form1.h also.

U better check code.If u can post me ur mail id, i can send u the modified code,which is working fine.This ,i've done this AFAIK.

Pardon me for any wrong things.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Using a dll project in a windows forms project

REspawn

thanks, my e-mail dave.respawn@gmail.com



Re: Visual C++ General Using a dll project in a windows forms project

TilakGopi

Hi dave,

I've just sent the code.

Thanx & Regards,

Ch.T.Gopi Kumar.






Re: Visual C++ General Using a dll project in a windows forms project

REspawn

works perfect, thanks for all the help TilakGopi



Re: Visual C++ General Using a dll project in a windows forms project

TilakGopi

welcome.

With Best Regards,

Ch.T.Gopi Kumar.