|
Have you tried changing calling convention:
[DllImport("BTDataAccess.dll", CallingConvention=CallingConvention.SomeCallingConvention)]
I already had problems when debugging/running by different calling conventions, as some exceptions are not thrown immediatelly on release code (but are still wrong). Maybe that's the case... maybe.
Try the charset also. I am only guessing, as I really don't know what is causing the problem.
|
|
|
|
|
Thanks for the suggestion, however, none of the five CallingConvention enum values fixed the problem.
What do you mean by charset?
On another note, we are running this as a single-threaded operation. There is a call to the c++ unmanaged dll made prior to the one in question. However, it is tasks with simply instantiating a COM object. This first call and the second one which fails is performed on the same thread. Multi-threaded operations on COM brings a lot of issues, but this isn't the case here. I realize each unit test in VS is on its own thread, however, we rigged it that calls to the same COM object are not performed from different threads.
|
|
|
|
|
You use string. There is the CallingConvention and the CharSet properties.
Also, the calling convention can be wrong in the method that was called just before. So, if you instantiate a COM object and after call a method, is possible that the instantiation is using an invalid calling convention.
But, I am unsure... why you can't simple import your Com object by Visual Studio Add Referece? It creates the the available components with the right calling convention.
|
|
|
|
|
Ok, the plot thickens.
A fellow developer wrote a bare-bones c# app that calls the c++ wrapper dll and it works from his computer. However, it fails from mine.
I tried each type of CharSet without success. Also, I tried it with callingconvention = CallingConvention.StdCall.
Btw, we used to use the automatically interop dll for calling the COM directly, however, it was very unstable. The funny thing is that stability is perfect with the approach using a hand-written c++ wrapper if called from c# under the context of visual studio unit testing.
|
|
|
|
|
Hi friends, my problem is to calculate the CRC value in the comunication between two terminal.
the string so composed:
10 02 (Start)
36 01 03 0e 57 00 00 00 29 00 00 (Data)
10 03 (End)
01 65 (CRC)
I already tried some CRC calculator but I have not found a correct calculation.
Can anyone give me some suggestions?
Thank you
Bye
|
|
|
|
|
http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net
http://www.codeproject.com/KB/recipes/crc32_dotnet.aspx
|
|
|
|
|
Probably not a CRC32, as it's only 2 bytes, but who knows..
Maybe Fletcher-16?
|
|
|
|
|
hello all,
Application.Run(new Form1());
How can i start an application so that other instance don't start of the same application.
regard,
sohail
|
|
|
|
|
hi ,
have a look to this link it will help u
link
|
|
|
|
|
There are several articles here on CP that cover that in a number of ways.
|
|
|
|
|
mention please...!
|
|
|
|
|
|
At the top of the page you will see a box labelled Search. Type single instance into this box. Select Articles / Quick Answers in the dropdown next to it. Click the Go! button.
|
|
|
|
|
Thanks you all
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:58am.
|
|
|
|
|
Don't point out or raise comments on anyone like that. This question is not just learning for me it can save any other person's time. you are not a child my dear.
|
|
|
|
|
Sohial A Rana wrote: you are not a child my dear.
But it seems you are a child asking others to search for you.
|
|
|
|
|
i know every type of problem can be solved via search engine. if every problem solve by searching then why people raise questions here?
|
|
|
|
|
Sohial A Rana wrote: i know every type of problem can be solved via search engine. if every problem solve by searching then why people raise questions here
|
|
|
|
|
Sohial A Rana wrote: i know every type of problem can be solved via search engine. if every problem solve by searching then why people raise questions here?
People come here only if they do not find the information through search engines. Google gave me 1,76,000 results for "C# Single instance", the top two of which are CP articles. If you had even tried this, you wouldn't have posted this question here.
|
|
|
|
|
Do you have trouble clicking the Search button ?
|
|
|
|
|
|
I have done it. Thanks for all
|
|
|
|
|
Try using Mutex for inter process communication it is best and as easy as needs only 3 lines of code
|
|
|
|
|