473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C# --> C++ Pointer question

Hello,

I am currently trying to interact with a unmanaged DLL (C++). I am attempting to call a method from the DLL that takes a List of unsigned longs and returns a status code.

Since List is of type General, this can not be marshaled so I am trying to send an Array instead. An issue arises because I need to call this Array later to get data from it and there is no method in the DLL to return this List (Array) to me.

I am trying to send a pointer of my Array in C# so I can read what is in the Array after the function in C++ inserts data into this Array.

from my main function
==================
myModules = new ArrayList();
int status = CDLL.GetModuleList(myModules);


from CDLL
========
[DLLImport("myDLL.dll", EntryPoint="GetModuleList"]
public static extern int GetModuleList(ArrayList moduleList);


This does not seem to work (I am not dealing with the pointers right now, I was just trying to call the function correctly).
Mar 6 '08 #1
1 816
Plater
7,872 Expert 4TB
Your DLLImport for the DLL function should have the same (or at least comparable) types for things.
ArrayList is not a valid unmanaged type. You would need to specify a DataType that works for both managed and unmanaged.
If it's a pointer, try using IntPtr
Mar 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: trustron | last post by:
Hi all, I have got a pointer question. I was told that a pointer is a variable holding a memory address. SO:
22
by: lokman | last post by:
Hi, In the following code, can someone tell me the difference between *p++ and p++ ? I can see both achieve the same result. Thanks a lot !
1
by: herrcho | last post by:
#include <stdio.h> int multi; int main() { printf("\nmulti = %u",multi); printf("\nmulti = %u",multi); printf("\n&multi = %u\n",&multi); return 0;
9
by: Arun Prasath | last post by:
Hi all, I have the following question regd pointer typecasting. Is the following type of pointer typecasting valid? #define ALLOC(type,num) ((type *)malloc(sizeof(type)*num)) /*begin...
2
by: beetle | last post by:
Hello, I'm storing data in several different binary tree's. The root node is located in a struct containing general data about the tree. struct lnode { char *fname; int nentry;
14
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good...
4
by: Jeffrey Spoon | last post by:
Hello, I am trying to make a simple function that returns a pointer to another function. In my header file I've declared my function pointer: void (*pStateFunction) (void); //assume the function...
18
by: mdh | last post by:
May I ask the following. By K&R's own admission, the example used to describe function pointers is complex ( on P119). In addition, the use of casts has been stated by some on this group as...
2
by: Giorgos Keramidas | last post by:
On Sun, 05 Oct 2008 18:22:13 +0300, Giorgos Keramidas <keramida@ceid.upatras.grwrote: My apologies. I should have been less hasty to hit `post'. If showtext() is passed a null pointer, it may...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
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...
0
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
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...

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.