How could I pass a double* argument form my C# application to C++ assembly code which has the following prototype
void abc(double * a, int nArgs
...
Thanks 6 2952
Hi,
"Sagiv" <an*******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com... How could I pass a double* argument form my C# application to C++ assembly
code which has the following prototype: void abc(double * a, int nArgs) { ... }
If "a" is an array :
[ImportDll("...")]
public static void abc([In,Out]double[] a, int nArgs);
The callee can change the array, but it cannot change the size and to access
the array safely the callee should know the size, maybe trough nArgs.
Otherwise:
[ImportDll("...")]
public static void abc( ref double a, int nArgs );
hth,
greetings Thanks,
Hi,
Thanks, in my case it's not a dll which I call, but a managed C++ code, therefore I have to call it directly
Is there a way to pass an argument from C# which is of type double *
Thanks a lot for your reply
Sagiv
"Sagiv" <an*******@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com... Hi, Thanks, in my case it's not a dll which I call, but a managed C++ code,
therefore I have to call it directly. Is there a way to pass an argument from C# which is of type double * ?
No, double* isn't managed.
void abc(double __gc * a, int nArgs)
void abc(double __gc & a, int nArgs)
void abc(System::Double * a, int nArgs)
void abc(System::Double & a, int nArgs)
These functions are all valid mc and the 'a' parameter would be a 'ref
double' in c#.
hth,
greetings Thanks a lot for your reply. Sagiv.
> Thanks, in my case it's not a dll which I call, but a managed C++ code,
therefore I have to call it directly. Is there a way to pass an argument from C# which is of type double * ?
What do you mean with directly? You cannot call code from an .exe or a .obj
file. You must compiler your c++ code into a dll, exporting the functions
you want to cann from your C# app.
If you are using managed C++, you can simply add your C++ project in your
workspace and call it exactly as you would call your C# stuff. Don't forget
to add the project reference to the c++ project in your c# project.
--
cody
Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk
> Thanks, in my case it's not a dll which I call, but a managed C++ code,
therefore I have to call it directly. Is there a way to pass an argument from C# which is of type double * ?
What do you mean with directly? You cannot call code from an .exe or a .obj
file. You must compiler your c++ code into a dll, exporting the functions
you want to cann from your C# app.
If you are using managed C++, you can simply add your C++ project in your
workspace and call it exactly as you would call your C# stuff. Don't forget
to add the project reference to the c++ project in your c# project.
--
cody
Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk Is there a way to pass an argument from C# which is of type double * ?
Yes, in an unsafe code block
double d = 123.45;
unsafe {
yourMCPPObject.YourMethod( &d );
}
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: cindy liu |
last post by:
Hi,
In .Net, how to convert a string to a double?
Thanks in advance!
Cindy
|
by: Sydex |
last post by:
When I compile code I get error
C2664: 'Integration::qgaus' : cannot convert parameter 1 from 'double
(double)' to 'double (__cdecl *)(double)'
in this part :
double Integration::quad2d(double...
|
by: Pascal |
last post by:
Why does this not work, and how should i do this convert in stead:
string x = double.MinValue.ToString();
double y = Convert.ToDouble(x);
i get this exception:
An unhandled exception of type...
|
by: Sam |
last post by:
How do I convert Julian Date to Calendar Date in ASP.Net 1.1 based on
following guideline found at Internet?
To convert Julian date to Gregorian date:
double JD = 2299160.5;
double Z =...
|
by: Daniel Walzenbach |
last post by:
Hi,
I wonder if somebody could explain me the difference between Double.Parse and Convert.ToDouble. If I'm not mistaken they are implemented differently (I though for a moment they might be the same...
|
by: David Scemama |
last post by:
Hi,
I'm writing a program using VB.NET that needs to communicate with a DOS
Pascal program than cannot be modified. The communication channel is through
some file databases, and I have a huge...
|
by: Eric BOUXIROT |
last post by:
hi,
i must convert all of these eVC++ prototypes to use with VB.NET....
DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title,...
|
by: PeterK |
last post by:
I am trying to set Public overridable CreditlimitS() as
System.Data.SqlTypes.SqlMoney to Creditlimit as Double
like CreditLimitS=creditlimit
and get this error "Value of type double cannot be...
|
by: Edwin Knoppert |
last post by:
In my code i use the text from a textbox and convert it to a double value.
I was using Convert.ToDouble() but i'm used to convert comma to dot.
This way i can assure the text is correct.
However...
|
by: mrajanikrishna |
last post by:
Hi Friends,
I am accepting a number from the user entered in a textbox.
I want to assign to a variable in my code and assignt this to that
variable.
double num1 = (double)txtNum1.text;
...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |