Click here to Skip to main content
15,887,961 members
Home / Discussions / C#
   

C#

 
GeneralRe: Marshaling between managed and unmanaged [modified] Pin
akhanal28-Sep-09 10:06
akhanal28-Sep-09 10:06 
GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn28-Sep-09 10:45
sitebuilderLuc Pattyn28-Sep-09 10:45 
GeneralRe: Marshaling between managed and unmanaged Pin
akhanal28-Sep-09 11:03
akhanal28-Sep-09 11:03 
GeneralRe: Marshaling between managed and unmanaged Pin
akhanal28-Sep-09 12:01
akhanal28-Sep-09 12:01 
GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn28-Sep-09 12:18
sitebuilderLuc Pattyn28-Sep-09 12:18 
GeneralRe: Marshaling between managed and unmanaged Pin
akhanal29-Sep-09 4:04
akhanal29-Sep-09 4:04 
GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn29-Sep-09 4:17
sitebuilderLuc Pattyn29-Sep-09 4:17 
GeneralRe: Marshaling between managed and unmanaged [modified] Pin
akhanal29-Sep-09 5:02
akhanal29-Sep-09 5:02 
Here is the modified code for the function that calls func1(getList()) and other functions from the dll:

void listTheMembers(unsigned __int16 ID1, unsigned __int16 ID2) 
{
    unsigned __int16* arg3;
    int i;
    unsigned int test;

    printf("\nMembers in list %d on server %d:\n", ID2, ID1);

    /* This gets array of Members */
    if((test = getList(ID1, ID2, &arg3)) != 0) 
    {  
        printf("Error getting member list for %d: %d\n", ID2, test);
        return;
    }

    if(!arg3[0]) {
        printf("No members\n\n");
        freeTheAllocatedMemory(arg3);
        return;
    }
    for(i=0; arg3[i]; i++) 
    {
        char* nameOfMember;
        
        /* This queries member's username... */   
        if((test = getName(ID1, arg3[i], Member_Username, &nameOfMember)) != 0)  
        {    
            printf("There was an error in querying member's username: %d\n", test);
            break;
        }
        
        printf("%u - %s \n", arg3[i], nameOfMember));
        freeTheAllocatedMemory(nameOfMember);
    }
    printf("\n");

    freeTheAllocatedMemory(arg3);  /* This releases the array */
}

The signatures for the called functions are:

unsigned int getList(unsigned __int16 ID1, unsigned __int16 ID2, unsigned __int16** result);
unsigned int freeTheAllocatedMemory(void* ptr);
unsigned int getName(unsigned __int16 ID1, unsigned __int16 MemberID, size_t flag, int* MemberName);



No. Some articles yes. And I am in the middle of writing my own.

That's great, it will be awesome to read one. Smile | :)

modified on Tuesday, September 29, 2009 11:11 AM

GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn29-Sep-09 5:36
sitebuilderLuc Pattyn29-Sep-09 5:36 
GeneralRe: Marshaling between managed and unmanaged Pin
akhanal29-Sep-09 5:32
akhanal29-Sep-09 5:32 
GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn29-Sep-09 5:37
sitebuilderLuc Pattyn29-Sep-09 5:37 
GeneralRe: Marshaling between managed and unmanaged [modified] Pin
akhanal29-Sep-09 6:01
akhanal29-Sep-09 6:01 
GeneralRe: Marshaling between managed and unmanaged Pin
Luc Pattyn29-Sep-09 6:15
sitebuilderLuc Pattyn29-Sep-09 6:15 
GeneralRe: Marshaling between managed and unmanaged Pin
akhanal29-Sep-09 6:27
akhanal29-Sep-09 6:27 
QuestionGetting the selected items from a radioButton group Pin
Twyce28-Sep-09 6:42
Twyce28-Sep-09 6:42 
AnswerRe: Getting the selected items from a radioButton group Pin
Michael Eber28-Sep-09 7:04
Michael Eber28-Sep-09 7:04 
QuestionCrystal Report at User's Computer Pin
Said Ali Jalali28-Sep-09 5:05
Said Ali Jalali28-Sep-09 5:05 
AnswerRe: Crystal Report at User's Computer Pin
Not Active28-Sep-09 5:12
mentorNot Active28-Sep-09 5:12 
AnswerRe: Crystal Report at User's Computer Pin
hosseinghazanfary28-Sep-09 6:08
hosseinghazanfary28-Sep-09 6:08 
AnswerRe: Crystal Report at User's Computer Pin
Paramhans Dubey29-Sep-09 2:45
professionalParamhans Dubey29-Sep-09 2:45 
QuestionSelect Row in DataGridView By Using Code (Physically) Pin
Thaer Hamael28-Sep-09 5:02
Thaer Hamael28-Sep-09 5:02 
AnswerRe: Select Row in DataGridView By Using Code (Physically) Pin
Not Active28-Sep-09 5:10
mentorNot Active28-Sep-09 5:10 
GeneralRe: Select Row in DataGridView By Using Code (Physically) Pin
Thaer Hamael28-Sep-09 5:20
Thaer Hamael28-Sep-09 5:20 
GeneralRe: Select Row in DataGridView By Using Code (Physically) Pin
MickCurley28-Sep-09 7:20
MickCurley28-Sep-09 7:20 
GeneralRe: Select Row in DataGridView By Using Code (Physically) Pin
Thaer Hamael28-Sep-09 20:48
Thaer Hamael28-Sep-09 20:48 

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.