Search Results

Search found 11321 results on 453 pages for 'shared libraries'.

Page 8/453 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Testing shared memory ,strange thing happen

    - by barfatchen
    I have 2 program compiled in 4.1.2 running in RedHat 5.5 , It is a simple job to test shared memory , shmem1.c like following : #define STATE_FILE "/program.shared" #define NAMESIZE 1024 #define MAXNAMES 100 typedef struct { char name[MAXNAMES][NAMESIZE]; int heartbeat ; int iFlag ; } SHARED_VAR; int main (void) { int first = 0; int shm_fd; static SHARED_VAR *conf; if((shm_fd = shm_open(STATE_FILE, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE))) > 0 ) { first = 1; /* We are the first instance */ } else if((shm_fd = shm_open(STATE_FILE, (O_CREAT | O_RDWR), (S_IREAD | S_IWRITE))) < 0) { printf("Could not create shm object. %s\n", strerror(errno)); return errno; } if((conf = mmap(0, sizeof(SHARED_VAR), (PROT_READ | PROT_WRITE), MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { return errno; } if(first) { for(idx=0;idx< 1000000000;idx++) { conf->heartbeat = conf->heartbeat + 1 ; } } printf("conf->heartbeat=(%d)\n",conf->heartbeat) ; close(shm_fd); shm_unlink(STATE_FILE); exit(0); }//main And shmem2.c like following : #define STATE_FILE "/program.shared" #define NAMESIZE 1024 #define MAXNAMES 100 typedef struct { char name[MAXNAMES][NAMESIZE]; int heartbeat ; int iFlag ; } SHARED_VAR; int main (void) { int first = 0; int shm_fd; static SHARED_VAR *conf; if((shm_fd = shm_open(STATE_FILE, (O_RDWR), (S_IREAD | S_IWRITE))) < 0) { printf("Could not create shm object. %s\n", strerror(errno)); return errno; } ftruncate(shm_fd, sizeof(SHARED_VAR)); if((conf = mmap(0, sizeof(SHARED_VAR), (PROT_READ | PROT_WRITE), MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { return errno; } int idx ; for(idx=0;idx< 1000000000;idx++) { conf->heartbeat = conf->heartbeat + 1 ; } printf("conf->heartbeat=(%d)\n",conf->heartbeat) ; close(shm_fd); exit(0); } After compiled : gcc shmem1.c -lpthread -lrt -o shmem1.exe gcc shmem2.c -lpthread -lrt -o shmem2.exe And Run both program almost at the same time with 2 terminal : [test]$ ./shmem1.exe First creation of the shm. Setting up default values conf->heartbeat=(840825951) [test]$ ./shmem2.exe conf->heartbeat=(1215083817) I feel confused !! since shmem1.c is a loop 1,000,000,000 times , how can it be possible to have a answer like 840,825,951 ? I run shmem1.exe and shmem2.exe this way,most of the results are conf-heartbeat will larger than 1,000,000,000 , but seldom and randomly , I will see result conf-heartbeat will lesser than 1,000,000,000 , either in shmem1.exe or shmem2.exe !! if run shmem1.exe only , it is always print 1,000,000,000 , my question is , what is the reason cause conf-heartbeat=(840825951) in shmem1.exe ? Update: Although not sure , but I think I figure it out what is going on , If shmem1.exe run 10 times for example , then conf-heartbeat = 10 , in this time shmem1.exe take a rest and then back , shmem1.exe read from shared memory and conf-heartbeat = 8 , so shmem1.exe will continue from 8 , why conf-heartbeat = 8 ? I think it is because shmem2.exe update the shared memory data to 8 , shmem1.exe did not write 10 back to shared memory before it took a rest ....that is just my theory... i don't know how to prove it !!

    Read the article

  • GHC 6.12 and MacPorts

    - by absz
    I recently installed GHC 6.12 and the Haskell Platform 2010.1.0.1 on my Intel MacBook running OS X 10.5.8, and initially, everything worked fine. However, I discovered that if I use cabal install to install a package which depends on a MacPorts library (e.g., cabal install --extra-lib-dirs=/opt/local/lib --extra-include-dirs=/opt/local/include gd), things work fine in GHCi, but if I try to compile, I get the error Linking test ... Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o) "_iconv", referenced from: _hs_iconv in libHSbase-4.2.0.0.a(iconv.o) "_iconv_open", referenced from: _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o) ld: symbol(s) not found collect2: ld returned 1 exit status After some Googling, I found a long Haskell-cafe thread discussing this problem. The upshot seems to be that MacPorts installs an updated version of libiconv, and the binary interface is slightly different from the version included with the system. Consequently, if you try to link with any MacPorts library, the MacPorts libiconv gets linked in too; and since the base library was built to link against a different version of libiconv, things break. I've tried setting LD_LIBRARY_PATH and DYLD_LIBRARY_PATH and adding more flags to try to get it to look at /usr/lib again (e.g. cabal install --extra-lib-dirs=/opt/local/lib --extra-include-dirs=/opt/local/include --extra-lib-dirs=/usr/lib --extra-include-dirs=/usr/include gd), but neither worked. Uninstalling the MacPorts libiconv isn't really an option, since I have a bunch of ports installed which depend on it---including some ports I want Haskell to link to, like gd2. From what I've seen online, the upshot really seems to be "you're boned": you cannot link against any MacPorts library while compiling with GHC, and there doesn't seem to be a solution. However, that thread was from the end of 2009, so I figure there's a chance that someone has a solution, workaround, ridiculous hack… anything, really. So: does anybody know how to get GHC 6.12 to link against the system libiconv at the same time as it links to libraries from MacPorts? Or, failing that, a way to make linking not break in some other clever way?

    Read the article

  • Why is rvalue write in shared memory array serialised?

    - by CJM
    I'm using CUDA 4.0 on a GPU with computing capability 2.1. One of my device functions is the following: device void test(int n, int* itemp) // itemp is shared memory pointer { const int tid = threadIdx.x; const int bdim = blockDim.x; int i, j, k; bool flag = 0; itemp[tid] = 0; for(i=tid; i<n; i+=bdim) { // { code that produces some values of "flag" } } itemp[tid] = flag; } Each thread is checking some conditions and producing a 0/1 flag. Then each thread is writing flag at the tid-th location of a shared int array. The write statement "itemp[tid] = flag;" gets serialized -- though "itemp[tid] = 0;" is not. This is causing huge performance lag which technically should not be there -- I want to avoid it. Please help.

    Read the article

  • Get Function Pointer to function in a shared library I didn't directly load

    - by bdk
    My Linux application (A) links against a Third Party shared Library (B) which I don't have source code to. This library makes use of another third party shared library that I don't have source code to (C). I believe that (B) uses dlopen to access (C) instead of directly linking. My reasoning for this is that 'ldd' on (B) does not show (C) and objdump -X (B) shows references to dlopen/dlclose/dlsym. My requirement is that I need to in my code for (A) get a function pointer to a function foo() located in (C). Normally I'd use dlsym for this, but I need to pass it the handle returned from dlopen which I don't have since (B) does not expose this. - For the larger context: I need to modify the function in (C) such that everytime it calls its helper function bar() (also located in (C)), it also calls a function with the same signature located in (A) with the same parameters (Basically inject my code into the codepath of (C) foo()-bar(). I believe I've found a way to accomplish this using gdb, but in order to port my gdb command list, but I'm stuck on the step of getting the function pointer. I'm also open to alternatives to accomplish the same task rather than the exact problem as stated above Edit: After writing this I realized I can probably just do another dlopen on the file in my code and the symbols returned via dlsym on that handle should be the same as received via the original dlopen, If I'm reading the dlopen man page correctly. However I'm still interested in advice or assistance with the my larger context, If theres a better way to go about this

    Read the article

  • How do I create and conveniently search through Libraries in Windows 8?

    - by mtone
    In Windows 7, I took the habit of putting most of my frequently accessed disk areas as Libraries - there were about a dozen. Typing a word in the Start menu would then give me a summary of matches by Library. For example, searching for "WPF" would tell me that I've got some results in the Books library, in the Coding library and a few other PDFs in the Downloads library, one of which I could then expand to see all results within. In Windows 8, that functionality appears to be gone. The Search function in the Charms Bar lists tons of results by type (Documents, Pictures, et cetera) but not by Library. This is practically useless since Documents contains hundreds of .txt and .cs files, a few of which might be Books or Downloads. The only option I found is to go into Explorer and use the search bar in the Library section. However, there again, all search results are mixed together, and I can't seem to find a way to know which Library each result came from (in the Details view, I didn't find a Library column I could add). So, if I want to know which Library contains stuff about a given topic, I have to search the Libraries one by one. Very inconvenient. Is Microsoft slowly deprecating libraries? Any tips? How else can I search through libraries?

    Read the article

  • How to access variables in shared memory

    - by user1723361
    I am trying to create a shared memory segment containing three integers and an array. The segment is created and a pointer is attached, but when I try to access the values of the variables (whether changing, printing, etc.) I get a segmentation fault. Here is the code I tried: #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> #define SIZE 10 int* shm_front; int* shm_end; int* shm_count; int* shm_array; int shm_size = 3*sizeof(int) + sizeof(shm_array[SIZE]); int main(int argc, char* argsv[]) { int shmid; //create shared memory segment if((shmid = shmget(IPC_PRIVATE, shm_size, 0644)) == -1) { printf("error in shmget"); exit(1); } //obtain the pointer to the segment if((shm_front = (int*)shmat(shmid, (void *)0, 0)) == (void *)-1) { printf("error in shmat"); exit(1); } //move down the segment to set the other pointers shm_end = shm_front + 1; shm_count = shm_front + 2; shm_array = shm_front + 3; //tests on shm //*shm_end = 10; //gives segmentation fault //printf("\n%d", *shm_front); //gives segmentation fault //clean-up //get rid of shared memory shmdt(shm_front); shmctl(shmid, IPC_RMID, NULL); //printf("\n\n"); return 0; } I tried accessing the shared memory by dereferencing the pointer to the struct, but got a segmentation fault each time.

    Read the article

  • Returning a shared library symbol table

    - by joemoe
    For instance: void* sdl_library = dlopen("libSDL.so", RTLD_LAZY); void* initializer = dlsym(sdl_library,"SDL_Init"); Assuming no errors, initializer will point to the function SD_Init in the shared library libSDK.so. However this requires knowing the symbol "SDL_Init" exists. Is it possibly to query a library for all its symbols? Eg, in this case it would return SDL_Init, the function pointer, and any other symbols exported by libSDL.so.

    Read the article

  • VB .NET Shared Function if called multiple times simultaneously

    - by Mehdi Anis
    Consider I have a shared function:- Public Shared Function CalculateAreaFromRadius(ByVal radius As Double) As Double ' square the radius... Dim radiusSquared As Double radiusSquared = radius * radius ' multiply it by pi... Dim result As Double result = radiusSquared * Math.PI 'Wait a bit, for the sake of testing and 'simulate another call will be made b4 earlier one ended or such for i as Integer = 0 to integer.Max Next ' return the result... Return result End Function My Questions: If I have two or more threads in the same vb .net app and each of them calls the shared function at the same time with different RADIUS, will they each get their own AREA? I want to know for each call to the function if it is using same local variables or each call creates new instances of local variables? Will the answers to above questions be same If I have multiple (2+) single threaded apps and they all call the function at the same time with different RADIUS value? I will appreciate your reponse. Thank you.

    Read the article

  • Zend Framework on a Shared Host

    - by manyxcxi
    I am trying to push my first ZF project to my shared hosting provider. I have done a lot of testing on my home server and everything is working great. My issue is that I do not know how to set up my .htaccess files on the shared hosting provider to make it work correctly. The ZF documentation says to configure my Apache config VirtualServer DocumentRoot to /whatever/path/project-folder/public, but I don't have that kind of access. How do I get around this? I have seen http://stackoverflow.com/questions/1115547/zend-framework-on-shared-hosting but none of those solutions have worked for me. My application path looks like this / - .htaccess - /application ... - /public -- .htaccess -- index.php -- ... ... My .htaccess files look like: /.htaccess RewriteEngine On RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L] RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ public/$1 [L] /public/.htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]

    Read the article

  • Returning new base class when the parent class shared pointer is the return type

    - by Ben Dol
    Can you have a parent class shared pointer return type of a function and then return a new child class without it being a shared pointer? I'm not sure how shared pointers work in these situations, do they act like a regular pointer? Here is my example: BaseEventPtr Actions::getEvent(const std::string& nodeName) { if(asLowerCaseString(nodeName) == "action") return new ActionEvent(&m_interface); return nullptr; } ActionEvent is the subclass of BaseEvent in this situation. Cheers!

    Read the article

  • iPhone static libraries: How to hide instance variable

    - by Frenzy
    I'm creating a static library to share using the following guide: http://www.amateurinmotion.com/articles/2009/02/08/creating-a-static-library-for-iphone.html In one of the functions, I return a "SomeUIView" which is a subclass of UIView and is defined in the public header, however I don't want to expose the internal instance variable of SomeUIView in the public header. I've tried using categories for a private internal header file for SomeUIView, but I keep running into "Duplicate interface declaration for class 'SomeUIView'". Does anyone know how to do this? Thanks!

    Read the article

  • Weak-linking with static libraries

    - by Jaakko L.
    I have declared an external function with a GCC weak attribute in a .c file: extern int weakFunction( ) __attribute__ ((weak)); Compiled object file has weakFunction defined as a weak symbol. Output of nm: 1791: w weakFunction I am calling the weak defined function as follows: if (weakFunction != NULL) { weakFunction(); } When I link the program by defining the object files as parameters to GCC (gcc main.o weakf.o -o main.exe) weak symbols work fine. If I leave the weakf.o out of linking, the function address is NULL in main.c and the function won't be called. Problem is, when weakf.o is inside a static library, for some reason the linker doesn't find the function and the function address always ends up being NULL. Static library is created with ar: ar rcs weaklibrary weakf.o Anyone had similar problems?

    Read the article

  • Size of static libraries generated by XCode

    - by shaft80
    I have a project tree in XCode that looks like this: AppProject depends on ObjcWrapper that in turn depends on PureCppLib. ObjcWrapper and PureCppLib are static library projects. Combined, all sources barely reach 15k lines of code, and, as expected, the size of resulting binary is about 750Kb in release mode and slightly over 1Mb in debug mode. So far, so good. However, ObjcWraper.a and PureCppLib.a are over 6Mb each in either mode. So the first question is why it is so. But more importantly, how can I ensure that those static libs do not include parts or all of the source code? Thanks in advance!

    Read the article

  • Using Unit Tests While Developing Static Libraries in Obj-C

    - by macinjosh
    I'm developing a static library in Obj-C for a CocoaTouch project. I've added unit testing to my Xcode project by using the built in OCUnit framework. I can run tests successfully upon building the project and everything looks good. However I'm a little confused about something. Part of what the static library does is to connect to a URL and download the resource there. I constructed a test case that invokes the method that creates a connection and ensures the connection is successful. However when my tests run a connection is never made to my testing web server (where the connection is set to go). It seems my code is not actually being ran when the tests happen? Also, I am doing some NSLog calls in the unit tests and the code they run, but I never see those. I'm new to unit testing so I'm obviously not fully grasping what is going on here. Can anyone help me out here? P.S. By the way these are "Logical Tests" as Apple calls them so they are not linked against the library, instead the implementation files are included in the testing target.

    Read the article

  • classes and static variables in shared libraries

    - by abel
    I am trying to write something in c++ with an architecture like: App -- Core (.so) <-- Plugins (.so's) for linux, mac and windows. The Core is implicitly linked to App and Plugins are explicitly linked with dlopen/LoadLibrary to App. The problem I have: static variables in Core are duplicated at run-time -- Plugins and App have different copys of them. at least on mac, when a Plugin returns a pointer to App, dynamic casting that pointer in App always result in NULL. Can anyone give me some explanations and instructions for different platforms please? I know this may seem lazy to ask them all here but I really cannot find a systematic answer to this question.

    Read the article

  • Which .NET libraries do you use most ?

    - by Quandary
    Which .NET programming libaries do you use most ? I'm putting together a list, kind of "best of" SourceForge, CodePlex, Google Code, GitHub, etc. SourceForge.NET Nhibernate (database ORM) SharpZipLib (ZIP compression) itextsharp (PDF library) GitHub: JQuery (JavaScript) Google Code: aforge (imaging) Codeplex: Excel Data-Reader Other: bouncycastle.org (Encryption)

    Read the article

  • Linking error while using Qt static built libraries

    - by Kamran Amini
    I hope this is not a duplicate. Recently I'm developing a native C++ application using Qt 4.8.3 and VS2008. Since clients run the application on their naked machines, they need to install VC++ 2008 Redistribution package. So I decided to make it statically linked. I changed my project settings (C/C++ Code Generation Runtime Library) to /MTd. Also I compiled Qt again, this time using following commands for a static building; originally found on this blog Static Qt with static CRT (VS 2008) 1- replaced -MD with -MT in lines QMAKE_CFLAGS_RELEASE and QMAKE_CFLAGS_DEBUG in %QDIR%\mkspecs\win32-msvc2008\qmake.conf 2- nmake confclean 3- configure -static -platform win32-msvc2008 -no-webkit 4- nmake sub-src I compiled Qt successfully. But when I tried again to compile my application, it gave me some strange errors. 1>Linking... 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: bool __thiscall QBasicAtomicInt::deref(void)" (?deref@QBasicAtomicInt@@QAE_NXZ) already defined in QtCored4.lib(QtCored4.dll) 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: bool __thiscall QBasicAtomicInt::operator!=(int)const " (??9QBasicAtomicInt@@QBE_NH@Z) already defined in QtCored4.lib(QtCored4.dll) 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: __thiscall QString::~QString(void)" (??1QString@@QAE@XZ) already defined in QtCored4.lib(QtCored4.dll) I changed some lib files but with each change, situation got worse; for example I tried to use QtCored.lib instead of QtCored4.lib because it is newly created after compilation. I think I've missed something in building static Qt libs. Thanks.

    Read the article

  • On clients use generic driver for printer shared by CUPS

    - by Daniel
    I know this worked really easy with a recent CUPS version some years ago. Unfortunately I fail to do the following with latest CUPS nowadays. How to share a printer without using printer specific drivers on the clients with CUPS? The printer is a Samsung ML-2010. The important fact is that it needs a quite specific library for printing called splix. That is installed on the server and prints well. What makes trouble is using that printer over the network. I found out how to use Avahi under Linux to make use of DNSSD to advertise and discover printers. But as far as I understand the new CUPS offers the internal driver interface on the network. This has 2 major issues: anybody can fiddle with the driver and I don't trust any uncommon printer library to be "network secure" anyone who wants to use my printer including guests needs to install the specific drivers first I remember the old days when I could enable "Share this printer" on the CUPS server and all clients would magically detect the printer and just send their job data to the server and have it do the driver stuff. After everything a read I guess this is related to the changes Apple introduced with CUPS including dropping of the integrated network discovery protocol. If it helps: Server: Ubuntu LTS 12.04 Server with CUPS 1.5.3 Client: Arch Linux with current CUPS 1.6.1 On another box with Ubuntu the printer was setup automatically at least but the mechanism used the Splix library for that.

    Read the article

  • Linux Shared Memory

    - by Betamoo
    The function which creates shared memory in *inux programming takes a key as one of its parameters.. What is the meaning of this key? And How can I use it? Edit: Not shared memory id

    Read the article

  • Making shared library from exist o-files

    - by Ockonal
    Hi guys, I have a project. I need in shared library of it to use in extensions. I don't want to make copy of this project but with shared-library settings. Are there any way to build it using *.o-files from building project? As I understand, I can write makefile for this.

    Read the article

  • How to relink existing shared library with extra object file

    - by awy
    I have existing Linux shared object file (shared library) which has been stripped. I want to produce a new version of the library with some additional functions included. I had hoped that something like the following would work, but does not: ld -o newlib.so newfuncs.o --whole-archive existinglib.so I do not have the source to the existing library. I could get it but getting a full build environment with the necessary dependencies in place would be a lot of effort for what seems like a simple problem.

    Read the article

  • Calls to singleton library

    - by metdos
    I have a singleton class, and I will compile it as a library static(lib) or dynamic(dll). Is it guaranteed that calls to same file in a machine always refer to same and unique instance in both cases?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >