|
I had a similar problem, and I was able to avoid the complexities of marshalling by defining the same structure in both C# and C++.
A "char" is C# is NOT the same as a "char" in C++. C# uses unicode chars, which are usually longer than one byte. But a C# "byte" IS the same as a "char" in C++.
After you have what appear to be equivalent structures in both languages, write a test program that sets values in one, and see if you can pass it to the other unchanged. You can also use the sizeof () operator to see if the structure is the same size in both languages. (C# allows sizeof () to be used in unsafe mode.)
Ints and doubles are the same in both languages.
|
|
|
|
|
Thank you, Alan. I tried to write the equivalent struct, but my problem was when translating a char[100]. C# does not allow me to make structures with fields that have been initialized to a size. So, if I write this inside a struct in C#:
public byte[] bytes = new byte[100];
I have the following error: "cannot have instance field initializers in structs".
Thanks for the rest of your message, I'll test my program as you suggest. In fact, I tried to do this before, but I couldn't use sizeof() and forgot it; didn't knew I could use it in unsafe mode.
|
|
|
|
|
|
Awesome! Thank you very much, Alan! This makes my job MUCH easier.
|
|
|
|
|
Hi.
Can anyone describe that clearly ?
Thank you.
|
|
|
|
|
An assembly is either an EXE or a DLL.
|
|
|
|
|
blackjack2150 wrote: An assembly is either an EXE or a DLL.
Means for example MyApplication.exe is an assembly file ?
|
|
|
|
|
IF it is written in a .NET language, yes, it is an assembly.
|
|
|
|
|
Thank you leppie .
Then What's difference between them (DLL files & assembly files)
|
|
|
|
|
A dll can be either a native dll or a .NET assembly. The subject is very broad and I suggest you read up in MSDN on how the CLR works.
|
|
|
|
|
|
|
Glad to help you
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Lol, I think we should just point everyone to Wikipedia
|
|
|
|
|
A dynamic-link library (DLL) is an executable file that acts as a shared library of functions
Assemblies though may at times be equated to dlls its actuall nothing but “Actual Dlls”.
When it comes to dlls it gives way to a problem called “DLL hell”. That is when some appln is using a dll. A new version of the dll is now installed. Then the application will start using the new dll. If this dll is not backward compatible then it will result in a erro. This is called dll hell however new concept of assemblies in .Net avoid this. Here each dll is going to be used by particular application only this avoids the dll hell problem
In the past Dynamic Link Libraries (DLL) were located by the system environment's PATH setting and the Windows Registry. Globally and shared DLLs were stored in the Windows system folder. The identification was specified by the DLL's file name. These mechanisms do have certain drawbacks. One is that we can't move applications in our file system because the Windows Registry does have paths stored
With Microsoft.NET the Windows Registry is not used anymore and the libraries are stored either together with an application as Private Assemblies or in a Global Assembly Cache (GAC) as Global Assemblies to be shared among applications. Assemblies are signed and verified to recognise content modifications. They are identified by name and version to resolve incompatibility issues.
A Windows DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries.
COM (Component Object Model) is the component model based on the object oriented design, which means that the components represented by the COM component exists in the form of classes and objects implementing a standard specification defined by COM. COM components can be used by any program running on Windows Operating System; be it is written with VB, C++, Java or even some .NET compliant language like C# and VB.NET.
Dot NET assembly is the component standard specified by the .NET. Hence, dot net assemblies are understandable to only Microsoft.NET and can be used only in .NET managed applications.
|
|
|
|
|
Also note that assemblies aren't always just one file.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please, How to Read EEPROM Smart Card .
|
|
|
|
|
RTFM, how the hell are we suppose to know?
|
|
|
|
|
ewww !
a very very very very very bad question !
Type of EEProm, How this eprom est connected to your PC...
We need details please !
|
|
|
|
|
Hello All.
I was wondering if anybody new the framework or some example code to send an email from a windows application.
This can be done via launching a window which will have an 'automatic' attachment to be sent as an issues report.
This could also be done transparenently, i.e. Without launching the outlook window...Probably allot more complicated.
Any help would be appreciated.
Cheers
|
|
|
|
|
Like This[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
just look www.codeproject.com/KB/cs/Sending_Mails_From_C_.aspx
or
First find the System.Web.dll in your computer drive where .NET Framework installed
Then add a reference to that dll in your C# windows application.
then write following code to send email....
string smtpServer;
smtpServer= "127.0.0.1";
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.From = "From Email Address";
msg.To = "To Email Address";
msg.Body = "Body here";
System.Web.Mail.MailAttachment attachFile = new System.Web.Mail.MailAttachment("Filepath");
System.Web.Mail.SmtpMail.SmtpServer = smtpServer; System.Web.Mail.SmtpMail.Send(msg);
or
First find the System.Web.dll in your computer drive where .NET Framework installed
Then add a reference to that dll in your C# windows application.
then write following code to send email....
string smtpServer;
smtpServer= "127.0.0.1";
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.From = "From Email Address";
msg.To = "To Email Address";
msg.Body = "Body here";
System.Web.Mail.MailAttachment attachFile = new System.Web.Mail.MailAttachment("Filepath");
System.Web.Mail.SmtpMail.SmtpServer = smtpServer; System.Web.Mail.SmtpMail.Send(msg);
|
|
|
|
|
|
You need to do it carefully, Example: do not double click a submit button.
|
|
|
|
|
leppie wrote: Example: do not double click a submit button
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|