|
From managed code using .NET?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
|
|
I've ref class. I 've to use a function "ccap_start_capturing" that take a ptr,and a ptr to a callback function(on_jpeg_received) and another ptr to a function on_exit_capturing defined in this class. Both "ccap_start_capturing" and "on_jpeg_received" functions are defined in a file c that i can't modify.
//#include ...
ref class CamPanObj{
public:
CamPanObj(){
camaddr=new camaddr_t();
}
protected:
~CamPanObj()
{//...
}
public:
static void on_exit_capturing(int code)
{/..
}
CAPID rec_start(void)
{
...
capid=ccap_start_capturing(camaddr,on_jpeg_received,on_exit_capturing);
return (capid);
}
};
It returns a compile error
error C2664: 'ccap_start_capturing' : cannot convert parameter 3 from 'void (__clrcall *)(int)' to 'void (__cdecl *)(int)'
None of the functions with this name in scope match the target type
How can i resolve it?
Thanks, regards.
|
|
|
|
|
I have 2 applications in which I serialize data in one and deserialize data in the other utilizing the binary formatter. However, whenever I try to deserialize, I get the following exception error:
"An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll. Additional information: Unable to find assembly 'projectname, Version=1.0.XXXX.XXXX, Culture=neutral, PublicKeyToken=null'.
I tried to resolve the assembly that it is trying to find by using the System::ResolveEventHandler delegate and registering this method with the System::AppDomain's AssemblyResolve event before calling the Deserialize method. The problem is the ResolveEventHandler never gets fired, so I can't even attempt to load the assembly and consequently, it always fails at deserialization. Are there any ideas of what I am doing wrong or any examples of code I can look at?
|
|
|
|
|
I don't know if I understand it right. The error happens normally only if in the data which is deserialized are classes from an assembly which is not known in your project. Do you have a reference to this assembly in your second project?
Best regards
Hansjörg
|
|
|
|
|
Yes, I have referenced the assembly in my second project. I found that I was unable to fire the ResolveEventHandler because there was a copy of the first executable in the same directory as my second executable. When I removed this first executable from the same directory, the ResolveEventHandler gets fired. However, now I am having issues with Assembly::Load. It appears that this Assembly::Load is getting called over and over without ever returning the assembly. Eventually, I get a stack overflow exception error. Any ideas?
|
|
|
|
|
I'm pretty new to C++/CLI so please bare with me. I have a header "MyThread.h" that contains a Thread class. I added an include directive at the top of my frmMain.h so i can create an instance of this class. Everything is fine with that but when i include frmMain.h to MyThread.h i get alot of compile errors. I read somewhere of where you could add something like:
#ifndef FRMMAIN_H
#define FRMMAIN_H
#endif
to fix the issue but it isn't working. Any ideas?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
In one of the header files, you'll probably need a forward reference to avoid circular reference
problems.
Here's one way:
#pragma once
class CfrmMain;
class CMyThread
{
CfrmMain *pMainFrame;
};
#include "stdafx.h"
#include "MyThread.h"
#include "frmMain.h"
...
#pragma once
#include "MyThread.h"
class CfrmMain
{
CMyThread *pMyThread;
};
#include "stdafx.h"
#include "frmMain.h"
...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I have observed that, when we create an empty class, it takes 1bite space. I don’t know why it takes 1bit space. Will there be any implicit function created when we create an empty class??
Thanks,
Nandu.
|
|
|
|
|
This is using C++/CLI, or are you in the wrong forum ?
I don't see how you can decide that an empty class takes up one byte. One byte where ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: One byte where ?
He said one 'Bite'. Maybe it's an animal class or something.
led mike
|
|
|
|
|
Hi Nandu,
There will not be any implicit functions created. However it just follows the simple rule
"Types can not be of ZERO size".
Cheers,
Suresh
|
|
|
|
|
Function does not need space (data)...
|
|
|
|
|
|
Hi everyone,
I am using mysql 5.0.
I have a problem with my c++ application using mysql.
I compiled everything without any trouble.
Localy appliction works perfectly but when I upload it crash comes emediately.
Remotely I cannot use any function regarding mysql.
When I use mysql_init() application crashes.
Whitout mysql application is working.
On the server installed version of mysql is 5.027.
I cannot understand mistake.
If anyone can help me I would appreciate it very much.
an-arhos
Edit/Delete Message
|
|
|
|
|
What do you mean by crash?
How does this relate to managed C++?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The first three posts in this forum invoke a giant and produce visions of Fish Filet
led mike
|
|
|
|
|
Definitely! I'm torn - I'm not sure if the first or the third is "better"!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
O M G
Thanks man!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I was thinking we should start a FFOTD Award (Fish Filet of The Day) but I became concerned that McD's might not be able to keep up.
Also did you see my reply where I offered this Google Search[^]
I think I will be using that fairly often.
led mike
|
|
|
|
|
led mike wrote: I became concerned that McD's might not be able to keep up.
Yeah - I'm not sure about them keeping enough in stock, but there should be no shortage of
employees to prepare them!
led mike wrote: this Google Search[^]
Excellent! It's so good I'm not sure if I should laugh or sigh
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Is there any link which talks about file handling in mc++.
I have to specify the write mode for the file. I mixed both managed and unmanged code. From managed code i have to call unmanged code with the first parameter file name second parameter file mode(write mode)..How to specify the file mode.
pOap->Open(szTemp,FileWriteMode);
|
|
|
|