Click here to Skip to main content
15,896,269 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to Create shortcut to our application on client desctop in c#.net 3.5 windows application? Pin
Mirko19807-Apr-09 5:04
Mirko19807-Apr-09 5:04 
QuestionTransfer big file from PC to PPC Pin
E_Gold7-Apr-09 2:47
E_Gold7-Apr-09 2:47 
QuestionHow can we use AutoCompleteCustomSource for a TextBox ? Pin
Mohammad Dayyan7-Apr-09 2:43
Mohammad Dayyan7-Apr-09 2:43 
AnswerRe: How can we use AutoCompleteCustomSource for a TextBox ? Pin
DaveyM697-Apr-09 2:54
professionalDaveyM697-Apr-09 2:54 
GeneralRe: How can we use AutoCompleteCustomSource for a TextBox ? Pin
Mohammad Dayyan7-Apr-09 3:26
Mohammad Dayyan7-Apr-09 3:26 
GeneralRe: How can we use AutoCompleteCustomSource for a TextBox ? Pin
DaveyM697-Apr-09 3:41
professionalDaveyM697-Apr-09 3:41 
GeneralRe: How can we use AutoCompleteCustomSource for a TextBox ? Pin
Mohammad Dayyan7-Apr-09 3:42
Mohammad Dayyan7-Apr-09 3:42 
QuestionRetrieve array from unmanaged DLL into C# application Pin
User 127827-Apr-09 2:38
User 127827-Apr-09 2:38 
I'm trying to get an output array from a function in an unmanaged DLL into my C# application. I've already done some googling on this topic and while I've found some articles, none of the suggestions seem to work.

The DLL has a function prototype of
int GetData(int ID, float* Results)


The int that is returned is the length of the array

Internally to send the results back it does
Results=new float[length];
//Fill in results here


In my C# application I use a delegate to get the function results:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int delGetData(int TagID, ref IntPtr Results);


I then try and retrieve the results and copy to a managed array doing this:
IntPtr data=IntPtr.Zero;
int Len=GetData(ID, ref data);

if(Len==0)
//something happened, exit

float[] results=new float[Len];
Marshal.Copy(data, results, 0, Len);


I always get an exception on the Marshal.Copy because the source (data) is null.

I have some control over the unmanaged DLL, any suggestions on how to get these to interface?

Thanks

modified 12-Jul-20 21:01pm.

AnswerRe: Retrieve array from unmanaged DLL into C# application Pin
Nicholas Butler7-Apr-09 2:54
sitebuilderNicholas Butler7-Apr-09 2:54 
GeneralRe: Retrieve array from unmanaged DLL into C# application Pin
User 127828-Apr-09 16:41
User 127828-Apr-09 16:41 
AnswerRe: Retrieve array from unmanaged DLL into C# application Pin
Luc Pattyn7-Apr-09 3:42
sitebuilderLuc Pattyn7-Apr-09 3:42 
GeneralRe: Retrieve array from unmanaged DLL into C# application Pin
User 127828-Apr-09 16:42
User 127828-Apr-09 16:42 
QuestionMappings SSIS Pin
Bajker7-Apr-09 2:36
Bajker7-Apr-09 2:36 
QuestionExcel ADO and Cell Format Pin
pjank427-Apr-09 2:08
pjank427-Apr-09 2:08 
QuestionStatus bar Pin
Sajjad Leo7-Apr-09 1:14
Sajjad Leo7-Apr-09 1:14 
AnswerRe: Status bar Pin
stancrm7-Apr-09 1:30
stancrm7-Apr-09 1:30 
GeneralRe: Status bar Pin
Sajjad Leo7-Apr-09 1:39
Sajjad Leo7-Apr-09 1:39 
GeneralRe: Status bar Pin
Henry Minute7-Apr-09 2:02
Henry Minute7-Apr-09 2:02 
AnswerRe: Status bar [modified] Pin
12Code7-Apr-09 3:59
12Code7-Apr-09 3:59 
Questionhow to get the currency value from a website to local database Pin
gnanam.abraham7-Apr-09 0:50
gnanam.abraham7-Apr-09 0:50 
AnswerRe: how to get the currency value from a website to local database Pin
Vikram A Punathambekar7-Apr-09 1:02
Vikram A Punathambekar7-Apr-09 1:02 
AnswerRe: how to get the currency value from a website to local database Pin
Tom Deketelaere7-Apr-09 1:10
professionalTom Deketelaere7-Apr-09 1:10 
AnswerRe: how to get the currency value from a website to local database Pin
Christian Graus7-Apr-09 1:21
protectorChristian Graus7-Apr-09 1:21 
QuestionCannot open 2 or more outlook contact detail Pin
manfree7-Apr-09 0:38
manfree7-Apr-09 0:38 
QuestionHow to Create a setup file in c#.net3.5 windows application Pin
Narendra Reddy Vajrala7-Apr-09 0:14
Narendra Reddy Vajrala7-Apr-09 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.