Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 93/144 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • Place an object on top of stack in ILGenerator

    - by KiNGPiN
    I have to pass a function an instance of an object, so obviously all the information to be taken as argument is to be loaded onto the evaluation stack Here is the code that i am looking for someClass SomeObject = new someClass(); il.Emit(OpCodes.LoadObject, SomeObject); il.Emit(OpCodes.CallVirt, MethodInfo Function); public void Function(Object obj) { Type type = typeof(obj); //do something w.r.t to the type } I dont require any information stored in the class just the type and i cannot use any of the primitive types to take my decision on Last i read that i can use a pointer to load the type using some opcodes ... but i am completely lost here, any help or pointers to the right direction would be great :)

    Read the article

  • Unable to use 'class' as a key in NSDictionary with Xcode 4.5

    - by Vivin Paliath
    I'm trying to use a class as a key in an NSDictionary. I looked at the answer to this question and what I have is pretty much the same; I'm using setObject: forKey:. However, XCode complains, saying Incompatible pointer types sending 'Class' to parameter of type 'id<NSCopying>'. The call I have is: [_bugTypeToSerializerDictionary setObject: bugToStringSerializer forKey: [bugToStringSerializer serializedObjectType]]; bugToStringSerializer is an instance of BugToStringSerializer whose concrete implementations implement serializedObjectType. An example of a concrete implementation looks like this: - (Class) serializedObjectType { return [InfectableBug class]; } What am I doing wrong here?

    Read the article

  • Eclipse - CDT Content Assist extremely slow

    - by Salil
    Hi.. I just installed eclipse-cdt 3.2.2 on Linux (Mint). The content assist feature which pops up when you do a "." or "-" on a struct or struct pointer, is extremely slow and freezes the entire IDE for around 10-20 seconds. This I feel, is because it searches through the entire include directory /usr/include that comes by default for any C project that you create. How can this issue be solved? Thanks..

    Read the article

  • Tracking EXC_BAD_ACCESS on iPad

    - by Aleks
    I've been using this code to create my UIWindow UIMyWindow* win = [[UIMyWindow alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; UIMyWindow isn't anything special it just has a pointer to a C++ class that does some wrapping of ObjectiveC. Recently my application start crashing after adding some line of code that doesn't have to do anything with the error. The line of code that I added is just allocating a C++ object but the program execution never reaches this line. Interesting enough my code works in Release. My only guess is that I made some memory corruption on a completely different place. My questions are: What type of memory corruption that can be? And is there some good practices to track them down?

    Read the article

  • Pass 2d array to function in C?

    - by Evelyn
    I know it's simple, but I can't seem to make this work. My function is like so: int GefMain(int array[][5]) { //do stuff return 1; } In my main: int GefMain(int array[][5]); int main(void) { int array[1800][5]; GefMain(array); return 0; } I referred to this helpful resource, but I am still getting the error "warning: passing argument 1 of GefMain from incompatible pointer type." What am I doing wrong?

    Read the article

  • Same code... but warning!Any ideas?

    - by FILIaS
    I've a question for a warning message that i get. For this line,using qsort: qsort(catalog, MAX ,sizeof catalog, struct_cmp_by_amount); I get this warning: warning: passing argument 4 of ‘qsort’ makes pointer from integer without a cast struct_cmp_by_amount is another function on the program. BUT,for another program with the same code, with the same exactly struct_cmp_by_amount function, i dont get that warning for the 4th argument! qsort(structs, structs_len, sizeof(struct st_ex), struct_cmp_by_price); I'm wandering about why that;s happening. Have you any idea?

    Read the article

  • Process for linking static ObjC libraries in XCode

    - by madmik3
    I'm trying to link to a static library and I keep getting linker errors. I've found a few sites that post examples but I have not been able to see what I am doing wrong. First I create a project that will link to my lib add existing files find my .xcodeproj file select "Copy items into destination groups folder"... Select my host project as Add To Targets. Then I add a direct dependency to my host app expand targets double click MyHost.app click + under direct dependencies select my lib Then I set build flags double click MyHost application icon in Groups and Files. click the build tab then I set the OtherLinerFlag to -ObjC then I set Header Search Paths to my header file location for my static library. I pass the compile stage but any classes in my static lib cause linker error: literal-pointer@_OBJC@_cls_refs@SomeClass in MyHost.o thanks!

    Read the article

  • CKeditor 3.0 - How to know which toolbar button is clicked

    - by understack
    Hi, I want to update few variables when any of the toolbar button (like bold, italic etc) is clicked. I'm unable to trap 'click' event on any of these buttons. Could somebody give me an example when clicking on 'bold' button would also pop up an alert box? How can I trap 'paste' event? I've googled a lot and searched ckeditor forum but couldn't find any solution. Any pointer would be really helpful. Thanks.

    Read the article

  • iSightAudio.plugin error when playing video using MediaPlayer

    - by Elisabeth
    I am working on creating a simple iPhone app that plays a movie via URL. When I Build&Run to test in the simulator, it works fine; as soon as I start playing the movie, I get the following message in the console: [1757:4b03] Cannot find executable for CFBundle/CFPlugIn 0x820ffe0 </Library/Audio/Plug-Ins/HAL/iSightAudio.plugin> (not loaded) [1757:4b03] Cannot find function pointer iSightAudioNewPlugIn for factory 9BE7661E-8AEF-11D7-8692-000A959F49B0 in CFBundle/CFPlugIn 0x820ffe0 </Library/Audio/Plug-Ins/HAL/iSightAudio.plugin> (not loaded) I don't get this error on other programs, so I assume it has something to do with this specific program, which uses the MediaPlayer.framework. Does anyone know what is causing this problem and how to fix it? Thank you

    Read the article

  • Ways to divide the high/low byte from a 16bit address?

    - by Grissiom
    Hello, I'm developing a software on 8051 processor. A frequent job is to divide the high and low byte of a 16bit address. I want to see there are how many ways to achieve it. The ways I come up so far are: (say ptr is a 16bit pointer, and int is 16bit int) ADDH = (unsigned int) ptr >> 8; ADDL = (unsigned int) ptr & 0x00FF; and ADDH = ((unsigned char *)&ptr)[0]; ADDL = ((unsigned char *)&ptr)[1]; Does anyone have any other bright ideas? ;) And anyone can tell me which way is more efficient?

    Read the article

  • Are there any Python reference counting/garbage collection gotchas when dealing with C code?

    - by Jason Baker
    Just for the sheer heck of it, I've decided to create a Scheme binding to libpython so you can embed Python in Scheme programs. I'm already able to call into Python's C API, but I haven't really thought about memory management. The way mzscheme's FFI works is that I can call a function, and if that function returns a pointer to a PyObject, then I can have it automatically increment the reference count. Then, I can register a finalizer that will decrement the reference count when the Scheme object gets garbage collected. I've looked at the documentation for reference counting, and don't see any problems with this at first glance (although it may be sub-optimal in some cases). Are there any gotchas I'm missing? Also, I'm having trouble making heads or tails of the cyclic garbage collector documentation. What things will I need to bear in mind here? In particular, how do I make Python aware that I have a reference to something so it doesn't collect it while I'm still using it?

    Read the article

  • Strange error with CreateCompatibleDC

    - by sevaxx
    Maybe this is a foolish question, I can't see why I can not get a DC created in the following code : HBITMAP COcrDlg::LoadClippedBitmap(LPCTSTR pathName,UINT maxWidth,UINT maxHeight) { HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, pathName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (!hBmp) return NULL; HDC hdc = (HDC)GetDC(); HDC hdcMem = CreateCompatibleDC(hdc); if (!hdcMem) { DWORD err = GetLastError(); } ... ... ... The bitmap hBmp is loaded fine and hdc has a valid value. But the call to CreateCompatibleDC() returns a NULL pointer. Then, GetLastError() returns 0 ! Anybody can guess what's going on here , please ? PS : There are no memory allocations or GDI routines called before this one...so I think memory leaks should be ruled out.

    Read the article

  • Best way to reverse bitmap data that is upside down

    - by Wladimir
    Hello, I have a method that I call and it returns bitmap data from a capture device. It returns a pointer to the buffer data as an IntPtr and the buffer length as an int. I know in advance that this bitmap is a 24bpp and its width and height. The problem is that the buffer contains the bitmap data upside down and I need this data to be in the right order (reverse it). What I do is create a for loop and using CopyMemory, I copy each line (stride) of this data from bottom to up to a newly allocated memory space. Is there any way to make it faster than creating more memory each time I receive a new frame? It makes the application get a bit slow and consumes more memory as each bitmap is pretty big. I do this because I use another component that analyses the bitmaps and it doesn't work propertly if the bitmaps are upside down. I'm using .net, c# thanks!

    Read the article

  • FORTRAN function returning an array causes a segfault (calling from C++)

    - by Dane Larsen
    Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code, and it's giving me headaches. Some code: function c_error_message() character(len = 255) :: c_error_message errmsg(1:9) = 'ERROR MSG' return end That's the FORTRAN function. My first question is: Is there anything in there that would cause a segfault? If not, then second: What does that return? A pointer? I'm trying to call it with the following C statement: char *e = c_error_message_(); That causes a segfault. c_error_message(); That too causes a segfault. I declared c_error_message_() earlier on with the following code: extern"C" { char* c_error_message_(); } Would declaring a function with a different return type than the actual return type cause a segfault? I'm at a loss. Thanks for any replies.

    Read the article

  • Are there any C++ tools that detect misuse of static_cast, dynamic_cast, and reinterpret_cast?

    - by chrisp451
    The answers to the following question describe the recommended usage of static_cast, dynamic_cast, and reinterpret_cast in C++: http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used Do you know of any tools that can be used to detect misuse of these kinds of cast? Would a static analysis tool like PC-Lint or Coverity Static Analysis do this? The particular case that prompted this question was the inappropriate use of static_cast to downcast a pointer, which the compiler does not warn about. I'd like to detect this case using a tool, and not assume that developers will never make this mistake.

    Read the article

  • C -Segmentation fault after the 4th call of the function!

    - by FILIaS
    It seems at least weird to me... The program runs normally.But after I call the enter() function for the 4th time,there is a segmentation fault!I would appreciate any help. With the following function enter() I wanna add user commands' datas to a list. [Some part of the code is already posted on another question of me, but I think I should post it again...as it's a different problem I'm facing now.] /* struct for all the datas that user enters on file*/ typedef struct catalog { char short_name[50]; char surname[50]; signed int amount; char description[1000]; struct catalog *next; }catalog,*catalogPointer; catalogPointer current; catalogPointer head = NULL; void enter(void) //user command: i <name> <surname> <amount> <description> { int n,j=2,k=0; char temp[1500]; char *short_name,*surname,*description; signed int amount; char* params = strchr(command,' ') + 1; //strchr returns a pointer to the 1st space on the command.U want a pointer to the char right after that space. strcpy(temp, params); //params is saved as temp. char *curToken = strtok(temp," "); //strtok cuts 'temp' into strings between the spaces and saves them to 'curToken' printf("temp is:%s \n",temp); printf("\nWhat you entered for saving:\n"); for (n = 0; curToken; ++n) //until curToken ends: { if (curToken) { short_name = malloc(strlen(curToken) + 1); strncpy(short_name, curToken, sizeof (short_name)); } printf("Short Name: %s \n",short_name); curToken = strtok(NULL," "); if (curToken) { surname = malloc(strlen(curToken) + 1); strncpy(surname, curToken,sizeof (surname)); } printf("SurName: %s \n",surname); curToken = strtok(NULL," "); if (curToken) { //int * amount= malloc(sizeof (signed int *)); char *chk; amount = (int) strtol(curToken, &chk, 10); if (!isspace(*chk) && *chk != 0) fprintf(stderr,"Warning: expected integer value for amount, received %s instead\n",curToken); } printf("Amount: %d \n",amount); curToken = strtok(NULL,"\0"); if (curToken) { description = malloc(strlen(curToken) + 1); strncpy(description, curToken, sizeof (description)); } printf("Description: %s \n",description); break; } if (findEntryExists(head, surname,short_name) != NULL) //call function in order to see if entry exists already on the catalog printf("\nAn entry for <%s %s> is already in the catalog!\nNew entry not entered.\n",short_name,surname); else { printf("\nTry to entry <%s %s %d %s> in the catalog list!\n",short_name,surname,amount,description); newEntry(&head,short_name,surname,amount,description); printf("\n**Entry done!**\n"); } // Maintain the list in alphabetical order by surname. } catalogPointer findEntryExists (catalogPointer head, char num[],char first[]) { catalogPointer p = head; while (p != NULL && strcmp(p->surname, num) != 0 && strcmp(p->short_name,first) != 0) { p = p->next; } return p; } catalogPointer newEntry (catalog** headRef,char short_name[], char surname[], signed int amount, char description[]) { catalogPointer newNode = (catalogPointer)malloc(sizeof(catalog)); catalogPointer first; catalogPointer second; catalogPointer tmp; first=head; second=NULL; strcpy(newNode->short_name, short_name); strcpy(newNode->surname, surname); newNode->amount=amount; strcpy(newNode->description, description); //SEGMENTATION ON THE 4TH RUN OF PROGRAM STOPS HERE depending on the names each time it gets! while (first!=NULL) { if (strcmp(surname,first->surname)>0) second=first; else if (strcmp(surname,first->surname)==0) { if (strcmp(short_name,first->short_name)>0) second=first; } first=first->next; } if (second==NULL) { newNode->next=head; head=newNode; } else { tmp=second->next; newNode->next=tmp; first->next=newNode; } }

    Read the article

  • Reading in 4 bytes at a time

    - by alphomega
    I have a big file full of integers that I'm loading in. I've just started using C++, and I'm trying out the filestream stuff. From everything I've read, it appears I can only read in bytes, So I've had to set up a char array, and then cast it as a int pointer. Is there a way I can read in 4 bytes at a time, and eliminate the need for the char array? const int HRSIZE = 129951336; //The size of the table char bhr[HRSIZE]; //The table int *dwhr; int main() { ifstream fstr; /* load the handranks.dat file */ std::cout << "Loading table.dat...\n"; fstr.open("table.dat"); fstr.read(bhr, HRSIZE); fstr.close(); dwhr = (int *) bhr; }

    Read the article

  • Assigning a view controller to be the delegate of a subview which is not directly descendent?

    - by ambertch
    I am writing an iphone app where in numerous cases a subview needs to talk to its superview. For example: View A has a table view that contains photos A has a subview B which allows users to add photos, upon which I want to auto append them to A's table view So far I have been creating a @protocol in B, and registering A as the delegate. The problem in my case is that B has a subview C that allows users to add content, and I want actions in C to invoke changes in its grandparent, A. Currently I am working around this by passing around a self pointer to my base view controller (C.delegate = B.delegate), but it doesn't seem very proper to me. Any thoughts? (and/or general advice on code organization when all sort of subviews needs to talk to superviews would be greatly appreciated) Thanks!

    Read the article

  • Pass a Delphi class to a C++ function/method that expects a class with __thiscall methods.

    - by Alan G.
    I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces (abstract Delphi classes). Some of those classes have methods that need pointers to objects. These C++ methods are declared with the __thiscall calling convention (which I cannot change), which is just like __stdcall, except a this pointer is passed on the ECX register. I create the class instance in Delphi, then pass it on to the C++ method. I can set breakpoints in Delphi and see it hitting the exposed __stdcall methods in my Delphi class, but soon I get a STATUS_STACK_BUFFER_OVERRUN and the app has to exit. Is it possible to emulate/deal with __thiscall on the Delphi side of things? If I pass an object instantiated by the C++ system then all is good, and that object's methods are called (as would be expected), but this is useless - I need to pass Delphi objects. Edit 2010-04-19 18:12 This is what happens in more detail: The first method called (setLabel) exits with no error (though its a stub method). The second method called (init), enters then dies when it attempts to read the vol parameter. C++ Side #define SHAPES_EXPORT __declspec(dllexport) // just to show the value class SHAPES_EXPORT CBox { public: virtual ~CBox() {} virtual void init(double volume) = 0; virtual void grow(double amount) = 0; virtual void shrink(double amount) = 0; virtual void setID(int ID = 0) = 0; virtual void setLabel(const char* text) = 0; }; Delphi Side IBox = class public procedure destroyBox; virtual; stdcall; abstract; procedure init(vol: Double); virtual; stdcall; abstract; procedure grow(amount: Double); virtual; stdcall; abstract; procedure shrink(amount: Double); virtual; stdcall; abstract; procedure setID(val: Integer); virtual; stdcall; abstract; procedure setLabel(text: PChar); virtual; stdcall; abstract; end; TMyBox = class(IBox) protected FVolume: Double; FID: Integer; FLabel: String; // public constructor Create; destructor Destroy; override; // BEGIN Virtual Method implementation procedure destroyBox; override; stdcall; // empty - Dont need/want C++ to manage my Delphi objects, just call their methods procedure init(vol: Double); override; stdcall; // FVolume := vol; procedure grow(amount: Double); override; stdcall; // Inc(FVolume, amount); procedure shrink(amount: Double); override; stdcall; // Dec(FVolume, amount); procedure setID(val: Integer); override; stdcall; // FID := val; procedure setLabel(text: PChar); override; stdcall; // Stub method; empty. // END Virtual Method implementation property Volume: Double read FVolume; property ID: Integer read FID; property Label: String read FLabel; end; I would have half expected using stdcall alone to work, but something is messing up, not sure what, perhaps something to do with the ECX register being used? Help would be greatly appreciated. Edit 2010-04-19 17:42 Could it be that the ECX register needs to be preserved on entry and restored once the function exits? Is the this pointer required by C++? I'm probably just reaching at the moment based on some intense Google searches. I found something related, but it seems to be dealing with the reverse of this issue.

    Read the article

  • function and class to show image not working in php

    - by Gully
    i am trying to get get the following working nothing is happen when i use the function i am trying to get it to display images class ItemRes { //items DB var $img=""; } function ShowItemImage($index,$res_a){ if(sizeof($res_a) > $index){ if($res_a[$index] != NULL) { $cimg = $res_a[$index]->img; return "<img src='$cimg' width='70' height='70' style='cursor:pointer'></img>"; } }else{ return "<center class='whitetxt'><strong>Empty</strong></center>"; } } $res_array = array(); $idx=0; $result21 = mysql_query("SELECT * FROM photos WHERE eid='$eid' ORDER BY id DESC") or die (mysql_error()); while ($row21 = mysql_fetch_array($result21)) { $img_path = $row21['path']; $obj = new ItemRes(); $obj->img = $img_path; $res_array[$idx] = $obj; $idx++; } ShowItemImage(0,$res_array) ShowItemImage(1,$res_array)

    Read the article

  • Swap bits in c++ for a double

    - by hidayat
    Im trying to change from big endian to little endian on a double. One way to go is to use double val, tmp = 5.55; ((unsigned int *)&val)[0] = ntohl(((unsigned int *)&tmp)[1]); ((unsigned int *)&val)[1] = ntohl(((unsigned int *)&tmp)[0]); But then I get a warning: "dereferencing type-punned pointer will break strict-aliasing rules" and I dont want to turn this warning off. Another way to go is: #define ntohll(x) ( ( (uint64_t)(ntohl( (uint32_t)((x << 32) >> 32) )) << 32) | ntohl( ((uint32_t)(x >> 32)) ) ) val = (double)bswap_64(unsigned long long(tmp)); //or val = (double)ntohll(unsigned long long(tmp)); But then a lose the decimals. Anyone know a good way to swap the bits on a double without using a for loop?

    Read the article

  • Whats the problem with int *p=23;

    - by piemesons
    Yesterday in my interview I was asked this question. (At that time I was highly pressurized by so many abrupt questions). int *p; *p=23; printf('%d',*p); Is there any problem with this code? I explained him that you are trying to assign value to a pointer to whom memory is not allocated. But the way he reacted, it was like I am wrong. Although I got the job but after that he said Mohit think about this question again. I don't know what he was trying to say. Please let me know is there any problem in my answer?

    Read the article

  • UISearchDisplayController automatically creates a UIPopovercontroller to display content search result ?! How to dismiss it ?

    - by yonel
    Hi, I'm using a UISearchDisplayController with a UISearchBar. I put this UISearchBar in my app using IB and I get : Fine : when you start taping, the result popovercontroller appears magically (I didn't write anything on my own to make it appear !) Then, when a row is clicked among the result, I want to dismiss the PopoverController BUT at this stage, I never instantiated the UIPopoverController on my side : it looks like if there's an encapsulated behavior in the UISearchDisplayController that automatically wraps its searchContentsController inside a UIPopoverController. That's really great because everything works perfectly without doing anything except that I cannot get the reference to this UIPopoverController to dismiss it :( Does anyone know how to get the reference to this "magically" created UIPopoverController ? (this is the proof the iPad is really a "magical" device ;) I thought there would be a reference to the UIPopoverController from its contentController (through its parent property for instance), but I cannot find any way to get a pointer to it :/

    Read the article

  • Gruber URL Regex tweak to capture "domain.com"

    - by mootymoots
    I found an updated version of John Gruber's regex for url matching in this post by user GianPac, which states it's been adapted to recognize url without protocol or the www part: (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/?)(?:[^\s()<]+|(([^\s()<]+|(([^\s()<]+)))))(?:(([^\s()<]+|(([^\s()<]+))))|[^\s`!()[]{};:'\".,<?«»“”‘’])) Whilst this works in most cases, I found it does not match "google.com". It does match "google.comm" and "google.co.uk", so this must be a small oversight. The trouble is, I literally hate regex. It's the bane of my life. I just want to try and tweak this one more time to allow for "google.com" - can anyone throw me a pointer? I (think) it's something to do with this part of the code: +[.][a-z]{2,4}/?) ?

    Read the article

  • Windows debugging - WinDbg

    - by Santhosh77
    Hi, I got the following error while debuggging a process with its core dump. 0:000 !lmi test.exe Loaded Module Info: [test.exe] Module: test Base Address: 00400000 Image Name: test.exe Machine Type: 332 (I386) Time Stamp: 4a3a38ec Thu Jun 18 07:54:04 2009 Size: 27000 CheckSum: 54c30 Characteristics: 10f Debug Data Dirs: Type Size VA Pointer MISC 110, 0, 21000 [Debug data not mapped] FPO 50, 0, 21110 [Debug data not mapped] CODEVIEW 31820, 0, 21160 [Debug data not mapped] - Can't validate symbols, if present. Image Type: FILE - Image read successfully from debugger. test.exe Symbol Type: CV - Symbols loaded successfully from image path. Load Report: cv symbols & lines Does any body know what the error "CODEVIEW 31820, 0, 21160 [Debug data not mapped] - Can't validate symbols, if present." really mean? Is this error meant that i can't read public/private symbols from the executable? If it is not so, why does the WinDbg debugger throws this typr of error? Thanks in advance, Santhosh.

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >