473,795 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vector of doubles - pinning

Hi

Kind of newbie question:

We have a DLL with a function with a prototype like

void mult( int mtxhandle, double* x, double* y, int size );

where "size" is the size of both x and y vectors. What should be the correct
sintax to define its respective DllImport wrapper in order to use it (in C#)
like:

Double x[] = new Double[mysize];
Double y[] = new Double[mysize];

mult( handle, x, y, mysize );

Thank you

Henrique

Nov 16 '05 #1
2 1548
Try this

[DllImport("mydl l.dll")]
private static extern void (int mtxhandle, ref double x, ref double y, int
size);

--
Shak
(Houston)
"Henrique" <he************ @hotmail.com> wrote in message
news:Oj******** ******@tk2msftn gp13.phx.gbl...
Hi

Kind of newbie question:

We have a DLL with a function with a prototype like

void mult( int mtxhandle, double* x, double* y, int size );

where "size" is the size of both x and y vectors. What should be the correct sintax to define its respective DllImport wrapper in order to use it (in C#) like:

Double x[] = new Double[mysize];
Double y[] = new Double[mysize];

mult( handle, x, y, mysize );

Thank you

Henrique

Nov 16 '05 #2
Hi,

"Henrique" <he************ @hotmail.com> wrote in message
news:Oj******** ******@tk2msftn gp13.phx.gbl...
Hi

Kind of newbie question:

We have a DLL with a function with a prototype like

void mult( int mtxhandle, double* x, double* y, int size );
protoype:

[DllImport(...)]
public extern static mult( int mtxhandle, double[] x, double[] y, int
size );

call:
double[] x = new double[mysize];
double[] y = new double[mysize];
mult( handle, x, y, mysize );
HTH,
greetings

where "size" is the size of both x and y vectors. What should be the correct sintax to define its respective DllImport wrapper in order to use it (in C#) like:

Double x[] = new Double[mysize];
Double y[] = new Double[mysize];

mult( handle, x, y, mysize );


Thank you

Henrique

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3209
by: {AGUT2}=IWIK= | last post by:
Hello all, It's my fisrt post here and I am feeling a little stupid here, so go easy.. :) (Oh, and I've spent _hours_ searching...) I am desperately trying to read in an ASCII "stereolithography" file (*.STL) into my program. This has the following syntax... Begin STL Snippet **********
12
2348
by: BCC | last post by:
If I create a vector of vectors of double: std::vector< std::vector<double> > table1; Are my vectors of doubles uninitialized? Do I have to loop through table1 and initialize each vector of doubles using new? And in cleaning up, manually delete each of these vectors of doubles? Thanks,
8
25434
by: Markus Dehmann | last post by:
I am wondering what is the "best" code to print out the elements of a vector. Assume they contain strings. With "best", I mean shortest and most readable at the same time. Of course, a for loop can be done. But I guess one can do it more elegantly. Something like this would be possible:
14
2669
by: LumisROB | last post by:
Is it possible to create matrixes with vector <vector <double >> ? If it is possible which is the element m23 ? You excuse but I am not an expert Thanks ROB
2
4160
by: fred_stevens | last post by:
Hi all you C boffins: I need to sort a vector of doubles is ascending order. Qsort will return the sorted vector, but I need a vector of the indices of the sorted vector, not the actual sorted vector. Any ideas? Thanks in advance, Fred.
4
1414
by: Henrique Bucher | last post by:
Hi Kind of newbie question: We have a DLL with a function with a prototype like void mult( int mtxhandle, double* x, double* y, int size ); where "size" is the size of both x and y vectors. What should be the correct sintax to define its respective DllImport wrapper in order to use it like:
1
3960
by: Raghuram N K | last post by:
Hi, Following program compiles and executes successfully in windows with DevCPP compiler. When I compile the same in Linux with 'g++323' compiler I get following assignment error: cannot convert `__gnu_cxx::__normal_iterator<DailyTemp*, std::vector<DailyTemp, std::allocator<DailyTemp >' to `DailyTemp*' in assignment I believe the overloaded assignment operation is unable to recognize the
12
12558
by: DaTurk | last post by:
Hi, I have a rather interesting problem. I have a unmanged c++ class which needs to communicate information to managed c++ via callbacks, with a layer of c# on top of the managed c++ ultimatley retreiving the data. Presently all of the c++ code is still in .NET 1.1, so we're using a _nogc bridge class wrapped in a _gc c++ class in order to facilitate this interop. But we've converted everything not c++ to .NET 2.0 and would love to
4
1703
by: Christian Schmidt | last post by:
Hi all, I'm trying to implement a std::vector-like wrapper for IList. The hard part seems to be operator, because it returns an unmanaged reference. Probably I have to use pin_ptr to achieve this, but I don't know how. Can anybody help? Thanks, Christian
4
5534
by: Anonymous | last post by:
I ahve a vector of doubles taht I need to extract values from. I was just about to use the STL find() algo, but I have a couple of questions: first: can you specify the tolerance threshold to match on doubles? second: if yes, how may this be done (i.e. how many one specify the tolerance threshold for comparing doubles?)
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.