|
Hi,
i've made a managed wrapper(Managed Extensions) for a class, that was written in C++ with VS 6.0.
It works very fine but here's my problem:
I'd like to debug code of my C++-class. Any searches with google led to nothing.
Hope here in this discussion board there are some people who can help me ?
My environments:
VC++ 6.0 which i compiled the dll (source is available)
VS++ 7.0 2003 2 project: 1 project defines a managed wrapper which delegates all methode-calls to
the aggregated C++-class.
Thanx in advance
Eddy
|
|
|
|
|
VC 2003 does support mixed-mode debugging, but it's slow and doesn't work well all the time. You could force a debugger break by using an __asm int 3
Regards,
Nish
|
|
|
|
|
hello nish's,
this is right and i can set this debug-property, but
it wouldn't work practically ? If i debug, it will not jump into
source-code of the dll-VC6.0 project.
Have i set another switch or something else ?
thanx
|
|
|
|
|
It's been a while since I used VC 2003 to do a managed DLL, but if I remember right, it does break into the source code for the VC6 DLL, provided there's debug information in it.
Regards,
Nish
|
|
|
|
|
Hi,
I've just got Visual Studio 2005 Standard Edition and was writing a new CLR class
using this code
<br />
#using "System.dll"<br />
<br />
using namespace System;<br />
<br />
<br />
public ref class SimpleClass<br />
{<br />
public:<br />
SimpleClass();<br />
SimpleClass(System::String^ str,System::Int32 age);<br />
~SimpleClass();<br />
<br />
System::String^ GetName() {return _str;}<br />
void SetName(System::String^ str) {_str = str;}<br />
System::Int32 GetAge() {return _age;}<br />
<br />
private:<br />
System::Int32 _age;<br />
System::String^ _str;<br />
};<br />
<br />
SimpleClass::SimpleClass()<br />
{}<br />
<br />
SimpleClass::~SimpleClass()<br />
{}<br />
<br />
SimpleClass::SimpleClass(System::String^ str,System::Int32 age)<br />
{<br />
_str = str;<br />
_age = age;<br />
}<br />
then i wrote a cpp file
<br />
#include "simpleclass.h"<br />
<br />
int main()<br />
{<br />
SimpleClass SC = gcnew SimpleClass("Bob",13);<br />
<br />
Console::WriteLine(SC.GetAge());<br />
<br />
<br />
return 0;<br />
}<br />
I tried two modifactions both using the new '^' handle operator and normal class by saying
SimpleClass SC = gcnew SimpleClass().
However when i tried using "gcnew SimpleClass() it came up with error, no copy constructor.
So I wrote this :
<br />
SimpleClass(const SimpleClass& rhs);<br />
and it came up with several errors.
How do you write a copy constructor in C++ 2.0 please
Thanks
Tom
|
|
|
|
|
>>SimpleClass SC = gcnew SimpleClass();<<
SC is not a handle type. gcnew returns a handle.
You need to do one of these :-
SimpleClass^ SC = gcnew SimpleClass();
or
SimpleClass SC; //stack semantics
You don't need a copy constructor.
Regards,
Nish
-- modified at 9:20 Friday 13th January, 2006
|
|
|
|
|
Hi Nisht,
Thanks for the help!
I wanted to use like the class like this.
public ref class Class1 {
public:
void foo() {Console::Writeline("Hello World");
}
Class^ C1 = gcnew Class1();
C1->foo();
Class C2;
C2.foo()
Can that be done with managed classes.
Tom
|
|
|
|
|
|
I can make any of my MC++ classes have static properties (via the property keyword), but how can I create a property list dynamically at runtime?
Example?
Neil
|
|
|
|
|
Neil_Scales wrote: I can make any of my MC++ classes have static properties (via the property keyword), but how can I create a property list dynamically at runtime?
You cannot alter a class at runtime. You could attempt to dynamically create a new class derived from another class and then instantiate it dynamically at runtime.
Regards,
Nish
|
|
|
|
|
Does anyone have the source code for calulating the hyperbolic sine of an unknown angle, preferable in radian, ( sinh x )?
using the standard library of sine is not allowed.
therefore im stucked at quite beginning.
anyone can help me please?
im doing this for my project.
thank lots...
|
|
|
|
|
You could look at the Standard Library sources, couldn't you? BTW, please be aware that this is the C++/CLI forum.
Regards,
Nish
|
|
|
|
|
Hello,
Here is my environment:
Visual Studio .NET 2003 Fr
Framework: 1.1 SP1
OS: Win2000 pro SP4
I want to instanciate some class of an older none-MFC DLL which was compiled in C++ 6, from a new C++ .Net application. I have all .h, .lib and .dll files of this library.
My goal is to create a wrapper of this DLL in C++.NET in order to use it in a C# project.
Is it possible to make such wrapper ? and what is the right way to do it ?
Thanks for your answer.
PS : Sorry for my English, I'm french
|
|
|
|
|
Yes, what you intend to do is very much possible. I assume you have a DLL that exports some native C++ classes. You can write a C++/CLI mixed-mode DLL, that contains managed classes that wrap these native classes. Accessing the native DLL from the mixed-mode DLL is the same as how you would have done it in the pre-.NET days. Go ahead and try it out. You can post any issues you run into on this forum.
Regards,
Nish
|
|
|
|
|
Thanks for your support
After some tries, I sill got a problem at built time and I think it's a big one.
I think it's due to my native DLL which is compiled with STLport and ZThread Libraries
Here is the summary of what I've done :
I made a .net class library project. I added the good .lib and lib path in the link tab, the good include path in C++ tab, the good #include in my '.h' and click generate the soluce.
And .net said to me:
<br />
E:\Library\STLport-4.5.3\stlport\stl\_string.c(337): error C2143: erreur de syntaxe : absence de ';' avant '_STL::basic_string<_CharT,_Traits,_Alloc>::find'<br />
In english, it looks like this (I think):
<br />
E:\Library\STLport-4.5.3\stlport\stl\_string.c(337): error C2143: syntax error: no ';' found before '_STL::basic_string<_CharT,_Traits,_Alloc>::find'<br />
This error corresponds to the following code in the file "_string.c" of the STL:
<br />
template <class _CharT, class _Traits, class _Alloc> __size_type__<br />
basic_string<_CharT,_Traits,_Alloc> ::find(const _CharT* __s, size_type __pos, size_type __n) const <br />
{<br />
if (__pos + __n > size())<br />
return npos;<br />
else {<br />
const const_pointer __result =<br />
_STLP_STD::search((const _CharT*)this->_M_start + __pos, (const _CharT*)this->_M_finish, <br />
__s, __s + __n, _Eq_traits<_Traits>());<br />
return __result != this->_M_finish ? __result - this->_M_start : npos;<br />
}<br />
}<br />
If you have an idea of how can I solve this problem, I take it !!
Else I will continue to burn some candles at my village's church :-p
C U.
|
|
|
|
|
I presume you are using VC++ 2005, which is pretty strict as a compiler. My guess is that your STLport library is not compatible with the new compiler. To test that out, create a regular C++ project (unmanaged native) and try and see if you can compile STLport. Chances are good that it will fail.
Regards,
Nish
|
|
|
|
|
Nishant Sivakumar wrote: I presume you are using VC++ 2005
wrong
his first post says :
" Here is my environment:
" Visual Studio .NET 2003 Fr
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
toxcct wrote: wrong
his first post says :
" Here is my environment:
" Visual Studio .NET 2003 Fr
Oops
In any case, he still needs to try STLPort with a native project before he tries it with a /clr project.
Regards,
Nish
|
|
|
|
|
Yes, it fails with the same error.
So, no matter, I found another way to reach my goal.
I'm writing a vc6 DLL which uses the classes of my native DLL. This new DLL exports only methods.
And after, I will create a static class in my C# project and use [DllImport(...)] for each method. I think it's the better way, if we consider that it will take too much time to rewrite the whole native DLL in C++.Net.
Thanks for your help,
ChocoS.
|
|
|
|
|
Yep, your solution sounds good to me.
Regards,
Nish
|
|
|
|
|
Hi-
||I use Dev-C++||
Im still a beginner in C++, and I need to integrate text file database into my program. How do I create that database (I would prefer to use notepad), and what is the syntax of the C++ code to do this? Make this as simple as possible because I am a beginner. Thankyou for your help!
|
|
|
|
|
2 things :
1. read this note[^].
2. see Carlos antolini's ADO set of classes[^].
[edit]
i came back to you post and saw that you you're talking about notepad as a database... notepad is a text editor !!! a database such as SQL server or Oracle is far from being an easy thing to implement, but can be used quite easily.
if you know SQL, consider using such a DB. otherwise, using simple files to store your datas will need you to make a little reflection time about the files formatting, etc...
[/edit]
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 5:09 Tuesday 10th January, 2006
|
|
|
|
|
toxcct wrote: [edit]
i came back to you post and saw that you you're talking about notepad as a database... notepad is a text editor !!!
I think he wants to use notepad to create his text-based database (such as an XML file).
Regards,
Nish
|
|
|
|
|
You should look at the XML classes available in the .NET f/w.
Regards,
Nish
|
|
|
|
|
I think that you should read Chapter 5: Data File Metaformats[^] of The Art of Unix Programming[^]. Trust me, it applies to Windows, too. It won't give you the code; however, if you know how to open a file and read its contents, a standard format will help and this can help you choose a format.
I, too, use Dev-C++. I just wish it had support for Objective C.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|