CLR Class Libary

A

Asfar

Can anyone tell me how to write a CLR Class Library (C++/CLI DLL)

I have declared my class in .h file as

namespace Test
{
public ref class TestFunctions
{
public:
static bool Function1( );
}
}

and my .cpp file is
namespace Test
{
bool TestFunctions::Function1()
{
bool bRet = false;
return bRet;
}
}

Is this the best way to write a dll using C++/CLI.
I am declaring the functions as static so that I can use them directly from
my application.

Thanks,
-Asfar
 
B

Bruno van Dooren

Can anyone tell me how to write a CLR Class Library (C++/CLI DLL)
I have declared my class in .h file as

namespace Test
{
public ref class TestFunctions
{
public:
static bool Function1( );
}
}

and my .cpp file is
namespace Test
{
bool TestFunctions::Function1()
{
bool bRet = false;
return bRet;
}
}

Is this the best way to write a dll using C++/CLI.
I am declaring the functions as static so that I can use them directly
from my application.

Hi,

Another possibility is to implement the class completely in your .h file,
just like WinForms are implemented in VC++.
It is not the default C++ way, but you'll see the same style in C# where
there are no separate declaration and implementation.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top