|
Are r and c both > 0 when this is called ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yes, I'm calling
FMatrix::FMatrix(5);
I should add that every once in while when I build for debugging, I get a message warning me that: "The project is out of date. FastMath - Debug Win 32". Could the problems I'm having be something other that a coding problem? Something that goes wrong when building or something?
|
|
|
|
|
OK, yeah, if this is in a dll, it's possible you're not building the dll, or the one that your main program is seeing, is out of date.
Step into the code. Watch what the constructor and destructor do, assuming hte other methdos called are not changing state.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
No I suspected it could have something to do with me not linking well the two projects so I even built it all in one same project...included header and source files of my FMatrix class in the Test app and removed any linking to the dlls...just compiled it as one console app. I still got the same error and I still couldn't catch it with the debugger step by step.
I'm giving up, at least today. Thanks for all the help.
|
|
|
|
|
If you email me the project (christian dot graus at gmail dot com ), I'll look at it for you.
But, next time ask in the right forum
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks! I really apreciate it.
About the wrong sorry, yeah :s sorry about that. Didnt see the Visual C++ formun 
|
|
|
|
|
Ok Christian, thanks for all the help but I managed to track down the error. Must of had some other bug I fixed before when I tried to compile everything under the same project because otherwise it should have worked.
The thing is that in the FMatrix.h header file included in the Test project I wasn't including the private definitions. I thought that the header acted more like an interface than anything else and thus private members were not needed.
Once I included the private definitios in the FMatrix.h header file inside the Test app the problem disappeared.
Thanks for your help!
|
|
|
|
|
No worries, glad to help ( and glad that people are still learning C++ )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi all ,
i have a problem when i am trying to connect to the data base via Network or via Web.
this is my connection string :
static private string GetConnectionString()
{
return "Data Source=10.0.0.25\\SQLEXPRESS\\Databases\\FWR.MDF;Integrated Security=True;User Instance=True";
}
and i recive this error exption :
(An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified).
i want to know how to solve this error.
Best Regards
Ahmed EL Gendy
|
|
|
|
|
|
Dear all,
I want to use the DataSet component for my Multiclient application.
I want to use data sets in my wrapper class coded in managed C++ which provids an interface to my main application.
But I experienced some problem here. I want my DataSets will be act as a global one , through which all my functions in that class can access it.
How can I set it to be a global one ?
I can declare it in a function ...like :
A.cpp
-------------
void A::fun1()
{
Dataset^ ds;
ds = gcnew DataSet();
}
But when I am trying to set it in ".h " for public access ..like..
A.h
--------------
class A {
public :
Dataset^ ds;
};
I got some "mixing unmanaged and managed code " error...
I am a beginner in C++/CLI , but I need to port my existing VC 6 application
to VS 2005 and also I need to use DataSets for DB access .
So I use "#pragma managed " and "#pragma unmanaged " while compiling my application with /CLR option. Now I want to use the above said wrapper to replace my existing VC 6 wrapper class .
So pls help me...
Regards,
vinsankar
|
|
|
|
|
#include <vcclr.h>
...
class A {
public:
gcroot<Dataset^> ds;
};
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hello George.L.Jackson,
Your suggestion is good .... thank you...
Can u pls give me some links or some good books to refer C++/CLI...?
Regards
vinsankar
|
|
|
|
|
|
Another data type conversion question:
Is it possible to pass a c# stream to a C++/CLI wrapper method which in turn converts it to VARIANT type and passes it to an unmanaged C++ method?
Here are the two pieces of code that I would like to see working together:
<code>
Stream csStream = ...
managed.ManagedMethod( csStreamVar );
UnmanagedClass::UnmanagedMethod( VARIANT unmanStream )
{
...
}
</code>
Can someone help me fill the following C++/CLI wrapper method that converts the stream to VARIANT?
<code>
ManagedClass::ManagedMethod( Stream^ manStream )
{
... How to convert? ...
unmanaged.UnmanagedMethod( ...???... );
}
</code>
Thanks,
-----------------
Genaro
|
|
|
|
|
picazo wrote: Is it possible
Yes but you have to know what is in the stream to know how to configure the VARIANT, unless of course you have some Magic++ library that does that for you.
led mike
|
|
|
|
|
Can you give me an example of how you would do this if the stream is to contain well-formatted xml.
-----------------
Genaro
|
|
|
|
|
picazo wrote: Can you give me an example of how you would do this if the stream is to contain well-formatted xml
No, I will show an example of how things work, I will not do your work for you by providing you an example of how I "would" do it.
System::Xml::XmlDocument^ doc = gcnew System::Xml::XmlDocument();
System::IO::StringReader^ stream = gcnew System::IO::StringReader("<halp><halpme value=\"22\"/></halpme>");
doc->Load(stream);
System::String^ managedStr = doc->DocumentElement->Name;
System::String^ sval =
((System::Xml::XmlElement^)doc->DocumentElement->FirstChild)->GetAttribute("value");
int nval = System::Convert::ToInt32( sval);
_variant_t variant(nval);
std::cout << nval << std::endl;
std::cout << (int)variant << std::endl;
led mike
|
|
|
|
|
Hello,
I have the following unmanaged method:
<code>
BSTR UnmanagedClass::UnmanagedMethod( BSTR x, VARIANT y, BSTR z )
{
...
}
</code>
I am wrapping that method with the following C++/CLI method:
<code>
String^ ManagedClass::ManagedMethod( String^ x, String^ y, String^ z )
{
CComBSTR bstrX, bstrZ;
bstrX.Attach( ( BSTR )( void * )Marshal::StringToBSTR( x ) );
bstrZ.Attach( ( BSTR )( void * )Marshal::StringToBSTR( z ) );
????
return gcnew String( unmanaged->UnmanagedMethod( bstrX, ???, bstrZ ) );
}
</code>
The C++/CLI wrapper method will be accessed from C# as follows:
<code>
string x="some value", y="another value", z="a third value";
managed.ManagedMethod( x, y, z );
</code>
The problem I am having is converting the managed string handle (String^ y) to an unmanaged VARIANT parameter. I would like to be able to solve this problem without having to modify the unmanaged C++ code. Does anyone have any suggestions or ideas on how to do this?
Thanks in advance,
-----------------
Genaro
|
|
|
|
|
picazo wrote: Marshal::StringToBSTR
Returns an IntPtr. You can't just cast that to a BSTR you have to use a method like ToInt32().
led mike
|
|
|
|
|
led mike wrote: You can't just cast that to a BSTR you have to use a method like ToInt32().
ToPointer would be a better method to use there.
|
|
|
|
|
Nishant Sivakumar wrote: would be a better method to use
Sure but my level of apathy for people writing production code that can't blow their own nose is fairly high today.
I feel like starting a new CodeProject account with the user name "HellNo" for replying to all the "can you provide the code" lovelies. Or maybe I shoudl write a programming book titled "Copy Paste for Idiots"... wait...
Chapter One
Copy the following code and paste it into your code file at the appropriate location:
<code>int n = 11;</code>
Now modify the code until it produces the desired results. There finished... now all I need is to send it off to a publisher.
led mike
|
|
|
|
|
You could do a String^ -> BSTR -> VARIANT.
|
|
|
|
|
could you provide some sample code of how to do this? I thought of doing that, but I couldn't get it to work.
Thanks,
-----------------
Genaro
|
|
|
|
|
picazo wrote: could you provide some sample code of how to do this? I thought of doing that, but I couldn't get it to work.
Since you've already written code to convert String^ to BSTR, I presume your problem is with converting that to a VARIANT. To do that, you can use _variant_t which has a constructor that takes a BSTR, and use that. You can pass _variant_t anywhere a VARIANT is expected.
|
|
|
|