|
Hi,
I am looking for passing unsigned int* to managed C++ app
Ex:
Native C++:
void func(unsigned int * data)
{
//Here I have access to managed C++ class and I would like to know how to pass data to this class
managedwrapper->managedFunc( need to pass data)
}
ref class ManagedWrapper
{
managedFunc(get the data here)
{
//how to get the data here.
}
}
Thanks,
Paul
|
|
|
|
|
|
Hello,
I'm maintaining a previous system with VC++2003, and have to add more functions. I deveoped them with C# DLL. But now I can't call C# DLL from VC++ code.
pasted some code piece as below:
------------------------
c# part:
using System;
namespace MyCSClass
{
public class CSClass
{
public CSClass(){}
public void Print(){
System.Console.Writeline("Hello, I'm in CSClass");
}
}
}
--------------------
C++ part:
#using "..." //the DLL
using namespace MyCSClass;
void CPlus::CallCSClass()
{
CSClass ^ obj = gcnew CSClass();
obj->Print();
}
-----------------
The error is:
error C2143: Syntax error: missing ";" (before "^")
error C2065: "obj" undefined.
error C2227: "->Print" .....
Above is my translation, orginal is below:
error C2143: 语法错误 : 缺少“;”(在“^”的前面)
error C2143: 语法错误 : 缺少“;”(在“^”的前面)
error C2065: “objAuthen” : 未声明的标识符
error C2227: “->Authenticate”的左侧必须指向类/结构/联合类型是“'unknown-type'”
Anyone can help me? Thanks!
Code Project
|
|
|
|
|
Based on the compiler errors, it appears that the C++ file is not getting built with the /clr option. Check the project build properties to make sure CLR support is turned on.
Another thing to check is that you've added a reference to the C# assembly.
John
|
|
|
|
|
Yes, I'm sure turned on /clr. the building command line:
/O2 /AI "C:\git-hub\im-server\emc2s\MyTestInterop\Release" /AI "Release" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /MD /GS /Yu"stdafx.h" /Fp"Release/MyTestInterop.pch" /Fo"Release/" /Fd"Release/vc70.pdb" /W3 /nologo /c /Wp64 /Zi /clr /TP /FU "C:\git-hub\im-server\emc2s\EMLdap\obj\Release\EMLdap.dll" /FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll"
Another, I'm sure added C# assembly in reference.
Anyother ideas to resolve it?
Code Project
|
|
|
|
|
Perhaps open your assembly with ILDasm or DotPeek and make sure the class is exported properly. Can you access it from another C# solution?
|
|
|
|
|
Yes, I tried in DotPeek, it works well. Also it can be called in other C# project.
Any other ideas?
Code Project
|
|
|
|
|
plz give the source code for medical store management
|
|
|
|
|
|
Hello all, with
I am a socket programmer, and recently i'm learning MODBUS TCP, and I wanted to make a simple application using MODBUS TCP over ETHERNET, application has two programs, one is SERVER and other is CLIENT as we have in network programming, NOTE : Strictly on C only. I searched a lot and read but couldn't find anything except for C# .NET and serial configuration. If anyone can help...!!!?
|
|
|
|
|
|
Ya I have read all those docs but found nothing...m using Linux so I need API for that, not for win32 socket.
|
|
|
|
|
Well you need to go and ask at the Modbus website; they are the people who can tell you what is available.
Veni, vidi, abiit domum
|
|
|
|
|
I asked,them but they are not giving any kind kf response..!!!
|
|
|
|
|
Hi,
you may try freemodbus library.
The URL is
http://www.freemodbus.org/index.php?idx=5
|
|
|
|
|
Hello!
I have following problem. I want to create a application, which is using Netsh. I have created following code:
private: System::Void button1_Click( System::Object ^ sender, System::EventArgs ^ e ) {
Process ^ mojProces = gcnew Process();
ProcessStartInfo ^ startInfo = gcnew ProcessStartInfo( "cmd.exe" );
startInfo->Verb = "runas";
startInfo->Arguments =( "Administrator /c \"netsh wlan start hostednetwork\" " );
startInfo->UseShellExecute = false;
startInfo->CreateNoWindow = true;
startInfo->RedirectStandardOutput = true;
startInfo->RedirectStandardInput = true;
info->Text = "Sieć została uruchomiona.";
mojProces->StartInfo = startInfo;
mojProces->Start();
StreamReader ^ wynik = mojProces->StandardOutput;
String ^ wynik_konsoli = wynik->ReadToEnd();
wynik_wysw->Text = wynik_konsoli;
mojProces->WaitForExit();
mojProces->Close();
Now I would like to redirect output of CMD, but there is following problem. When I set UseShellExecute=false, I cannot run CMD with administrator privileges, which is required to use Netsh. But when I set true I cannot redirect output. Could you please help, how can I solve this problem? Thank you in advance!
|
|
|
|
|
if i have a function will used by a thread, how i lock it? i do not want the thread to finish..., as below
Main function()
{
----lock this area
code
another function()
code
code
----unlock this area
}
basically the Main function wont be executed by another thread until it's done..?
how?
modified 5-Feb-14 2:50am.
|
|
|
|
|
|
Dear readers,
I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();
if ( 0 == state ) {
if ( 1 == ReadSomeData() ) {
state = 1;
}
}
if ( 1 == state) {
if ( 0 == ReadSomeData() ) {
state = 0;
}
}
}
}
Is there a better place for asking this question
Thank you
modified 26-Jan-14 15:18pm.
|
|
|
|
|
Frygreen wrote: Is there a better place for asking this question We don't appear to have a forum dedicated to UML, so perhaps you could try the Quick Answers section.
Veni, vidi, abiit domum
|
|
|
|
|
Frygreen wrote: How can this be modelled with UML-State-Diagram?
State 1 points to state 0.
State 0 points to state 1.
|
|
|
|
|
A bit hard without the ability to embed an image, but I'll try:
/*********\
* *
* state 0 *
* *
\*********/
| ^ ^
| | |
v no| |yes
/ \ | |
/ \ | |
R==1?>-+ |
\ / ^
\ / / \
V / \
| <R==0?>-+
| \ / |
|yes \ / no|
| V |
| ^ |
| | |
v | |
/*********\ |
* * |
* state 1 *<--+
* *
\*********/
Ok, the readability suffers a bit - sorry for the bleeding eyes
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I'm learning dev C++ later to make an application any advice please?
|
|
|
|
|
Buy a book on C++, or use Google to find some of the thousands of samples that are available.
Veni, vidi, abiit domum
|
|
|
|
|
Identify your primary objective. If it is producing a new application, then stick to the language you know best, but if it is learning C++ then follow Richard's advice.
I faced the same choice some years back, and since my primary objective was learning C++ I went down this route. Had it been the production of a new application I would have continued with COBOL.
I never had any desire to branch out into C# but it made practical sense to adopt it for the WCF and ASP.NET aspects so that got learned too. Nowadays Visual Studio, and particularly the express versions offer better UI experiences in C#, so consider that C++ may not offer all you desire.
Ger
Ger
|
|
|
|