Search Results

Search found 129 results on 6 pages for 'linkage'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • What are the linkage of the following functions?

    - by Derui Si
    When I was reading the c++ 03 standard (7.1.1 Storage class specifiers [dcl.stc]), there are some examples as below, I'm not able to tell how the linkage of each successive declarations is determined? Could anyone help here? Thanks in advance! static char* f(); // f() has internal linkage char* f() { /* ... */ } // f() still has internal linkage char* g(); // g() has external linkage static char* g() { /* ... */ } // error: inconsistent linkage void h(); inline void h(); // external linkage inline void l(); void l(); // external linkage inline void m(); extern void m(); // external linkage static void n(); inline void n(); // internal linkage static int a; // a has internal linkage int a; // error: two definitions static int b; // b has internal linkage extern int b; // b still has internal linkage int c; // c has external linkage static int c; // error: inconsistent linkage extern int d; // d has external linkage static int d; // error: inconsistent linkage UPD: Additionally, how can I understand the statement in the standard, " The linkages implied by successive declarations for a given entity shall agree. That is, within a given scope, each declaration declaring the same object name or the same overloading of a function name shall imply the same linkage. Each function in a given set of overloaded functions can have a different linkage, however."

    Read the article

  • About inconsistent dll linkage

    - by baris_a
    How can I remove this link warning? You can see code segment that causes this warning. Also Thanks in advance. static AFX_EXTENSION_MODULE GuiCtrlsDLL = { NULL, NULL }; //bla bla // Exported DLL initialization is run in context of running application extern "C" void WINAPI InitGuiCtrlsDLL() { // create a new CDynLinkLibrary for this app new CDynLinkLibrary(GuiCtrlsDLL); // nothing more to do } warning C4273: 'InitGuiCtrlsDLL' : inconsisten t dll linkage I have also export and import definitions, like: #ifdef _GUICTRLS #define GUI_CTRLS_EXPORT __declspec(dllexport) #else #define GUI_CTRLS_EXPORT __declspec(dllimport) #endif

    Read the article

  • Linkage Error with Inherited Class

    - by metdos
    I have static library and another program which uses it. In the static library If I define header without inheretence it works fine. class TcpCommunication On the other hand If I use inheretence with a QT class, class TcpCommunication:public QTcpServer I'm getting linkage error when I compiling code which uses this static library. >MStoDKAPId.lib(TcpCommunication.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QTcpServer::~QTcpServer(void)" (__imp_??1QTcpServer@@UAE@XZ) referenced in function "public: virtual __thiscall TcpCommunication::~TcpCommunication(void)" (??1TcpCommunication@@UAE@XZ) What can be the problem? Thanks.

    Read the article

  • Howcome some C++ functions with unspecified linkage build with C linkage?

    - by christoffer
    This is something that makes me fairly perplexed. I have a C++ file that implements a set of functions, and a header file that defines prototypes for them. When building with Visual Studio or MingW-gcc, I get linking errors on two of the functions, and adding an 'extern "C"' qualifier resolved the error. How is this possible? Header file, "some_header.h": // Definition of struct DEMO_GLOBAL_DATA omitted DWORD WINAPI ThreadFunction(LPVOID lpData); void WriteLogString(void *pUserData, const char *pString, unsigned long nStringLen); void CheckValid(DEMO_GLOBAL_DATA *pData); int HandleStart(DEMO_GLOBAL_DATA * pDAta, TCHAR * pLogFileName); void HandleEnd(DEMO_GLOBAL_DATA *pData); C++ file, "some_implementation.cpp" #include "some_header.h" DWORD WINAPI ThreadFunction(LPVOID lpData) { /* omitted */ } void WriteLogString(void *pUserData, const char *pString, unsigned long nStringLen) { /* omitted */ } void CheckValid(DEMO_GLOBAL_DATA *pData) { /* omitted */ } int HandleStart(DEMO_GLOBAL_DATA * pDAta, TCHAR * pLogFileName) { /* omitted */ } void HandleEnd(DEMO_GLOBAL_DATA *pData) { /* omitted */ } The implementations compile without warnings, but when linking with the UI code that calls these, I get a normal error LNK2001: unresolved external symbol "int __cdecl HandleStart(struct _DEMO_GLOBAL_DATA *, wchar_t *) error LNK2001: unresolved external symbol "void __cdecl CheckValid(struct _DEMO_MAIN_GLOBAL_DATA * What really confuses me, now, is that only these two functions (HandleStart and CheckValid) seems to be built with C linkage. Explicitly adding "extern 'C'" declarations for only these two resolved the linking error, and the application builds and runs. Adding "extern 'C'" on some other function, such as HandleEnd, introduces a new linking error, so that one is obviously compiled correctly. The implementation file is never modified in any of this, only the prototypes.

    Read the article

  • Sortie des spécifications d'OpenCL 1.2 : séparation compilation/linkage, partitionnement et support de nouveaux types de périphériques

    Sortie des spécifications d'OpenCL 1.2 Séparation compilation/linkage, partitionnement et support de nouveaux types de périphérique Le groupe Khronos vient de ratifier et publier les spécifications d'OpenCL 1.2 (Open Computing Language), l'API et extension standardisée du langage C pour supporter le développement sur GPU et la programmation parallèle distribuée sur plusieurs types de processeurs compatibles. Parmi les nouveautés de cette version, citons : Le partitionnement des périphériques permet de diviser un périphérique en plusieurs sous-périphériques pour contrôler directement les tâches assignées à chaque unité de calcul ; Séparation de la compilation et ...

    Read the article

  • How extensive is an Object in CakePHP model linkage?

    - by Andre
    I was hoping someone with an understanding on CakePHP could shed some light on a question I've been having. Here's my scenario, I have a User this User has a Company which in turn has many Department and many Address. If I were to get a User could I expect to have access to the Company and all models associated with that Company? So would $user['Company']['Department'][0] or $user['Company']['Address'][0] be possible? Which brings me back to the original question, how extensive is the linkage between models?

    Read the article

  • Checking if a function has C-linkage at compile-time

    - by scjohnno
    Is there any way to check if a given function is declared with C-linkage (that is, with extern "C") at compile-time? I am developing a plugin system. Each plugin can supply factory functions to the plugin-loading code. However, this has to be done via name (and subsequent use of GetProcAddress or dlsym). This requires that the functions be declared with C-linkage so as to prevent name-mangling. It would be nice to be able to throw a compiler error if the referred-to function is declared with C++-linkage (as opposed to finding out at runtime when a function with that name does not exist). Here's a simplified example of what I mean: extern "C" void my_func() { } void my_other_func() { } // Replace this struct with one that actually works template<typename T> struct is_c_linkage { static const bool value = true; }; template<typename T> void assertCLinkage(T *func) { static_assert(is_c_linkage<T>::value, "Supplied function does not have C-linkage"); } int main() { assertCLinkage(my_func); // Should compile assertCLinkage(my_other_func); // Should NOT compile } Thanks.

    Read the article

  • Checking if a function has C-linkage at compile-time [unsolvable]

    - by scjohnno
    Is there any way to check if a given function is declared with C-linkage (that is, with extern "C") at compile-time? I am developing a plugin system. Each plugin can supply factory functions to the plugin-loading code. However, this has to be done via name (and subsequent use of GetProcAddress or dlsym). This requires that the functions be declared with C-linkage so as to prevent name-mangling. It would be nice to be able to throw a compiler error if the referred-to function is declared with C++-linkage (as opposed to finding out at runtime when a function with that name does not exist). Here's a simplified example of what I mean: extern "C" void my_func() { } void my_other_func() { } // Replace this struct with one that actually works template<typename T> struct is_c_linkage { static const bool value = true; }; template<typename T> void assertCLinkage(T *func) { static_assert(is_c_linkage<T>::value, "Supplied function does not have C-linkage"); } int main() { assertCLinkage(my_func); // Should compile assertCLinkage(my_other_func); // Should NOT compile } Is there a possible implementation of is_c_linkage that would throw a compiler error for the second function, but not the first? I'm not sure that it's possible (though it may exist as a compiler extension, which I'd still like to know of). Thanks.

    Read the article

  • nasm/yasm arguments, linkage to C++

    - by arionik
    Hello everybody, I've got a question concerning nasm and its linkage to C++. I declare a litte test function as extern "C" void __cdecl myTest( byte i1, byte i2, int stride, int *width ); and I call it like this: byte i1 = 1, i2 = 2; int stride = 3, width = 4; myTest( i1, i2, stride, &width ); the method only serves to debug assembly and have a look at how the stack pointer is used to get the arguments. beyond that, the pointer arguments value shall be set to 7, to figure out how that works. This is implemented like this: global _myTest _myTest: mov eax, [esp+4] ; 1 mov ebx, [esp+8] ; 2 mov ecx, dword [esp+16] ; width mov edx, dword [esp+12] ; stride mov eax, dword [esp+16] mov dword [eax], 7 ret and compiled via yasm -f win32 -g cv8 -m x86 -o "$(IntDir)\$(InputName).obj" "$(InputPath)" , then linked to the c++ app. In debug mode, everything works fine. the function is called a couple of times and works as expected, whereas in release mode the function works once, but subsequent programm operations fail. It seems to me that something's wrong with stack/frame pointers, near/far, but I'm quite new to this subject and need a little help. thanks in advance! a.

    Read the article

  • Tomcat JAXB 1 and 2 linkage error

    - by Alex
    I'm running a tomcat 6, spring, apache cxf webservice, know it is a must to add one third party library to my webapp to fulfill an order. I have jaxb-impl-2.1.12.jar for apache cxf in WEB-INF/lib folder and the new library which contains the JAXB 1.0 runtime. JAXB 2 ist used by apache cxf for dynamic clients (i need them). So is there a possibility to run the webapps with both libraries? Error: Caused by: java.lang.LinkageError: You are trying to run JAXB 2.0 runtime but you have old JAXB 1.0 runtime earlier in the classpath. Please remove the JAXB 1.0 runtime for 2.0 runtime to work correctly.

    Read the article

  • Grails - attempting to include HTPPBuilder - Linkage error

    - by Stefan Kendall
    When I run grails install-dependency, I get this. java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/xml/sax/SAXParseException" What's wrong? I've not used grails dependency management before, and this is rather cryptic. repositories { grailsPlugins() grailsHome() mavenLocal() mavenCentral() } dependencies { runtime 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0' }

    Read the article

  • Extraneous Library Linkage

    - by gmatt
    I have a question which may be somewhat silly because I'm pretty sure I may know the answer already. Suppose you have static library A, and dynamic shared object library B and your program C under linux. Suppose that library A calls functions from library B and your program calls functions from library A. Now suppose that all functions that C calls in A make no use of functions in B. To compile C will it be enough to link just A and omit B and furthermore can your program C be run on a system without library B installed?

    Read the article

  • Determining linkage dependencies in Flex applications

    - by Kai
    I have a large Flex project with two Applications in it. A lot of code is shared between these Applications. However, the smaller of the Applications does not require much of the code that the larger one does. I'm trying to ensure that code that isn't required by the smaller application isn't getting compiled into it. Is there an easy way for me to determine which files within my project are being compiled into a particular Application?

    Read the article

  • Customizing File Linkage for a Build Configuration (Not Buil Target)

    - by ZaBlanc
    I have a project that has several build configurations (FREE version, male-only, female-only, etc.). I am avoiding using multiple build targets because (A) the products are mostly all the same and (B) I don't want to have to do checkbox-management to keep every file I have included with all the targets. However, I have just a few files it would be nice NOT to include in certain builds. For example, I have male and female voice files, but I only want the male files in the male build and female voices in the female build. Question...is there a way to manage the build configuration to prevent these files from being included/linked in? What are my options?

    Read the article

  • Linkage of namespace functions

    - by user144182
    I have a couple of methods declared at the namespace level within a header for a class: // MyClass.h namespace network { int Method1(double d); int Method2(double d); class MyClass { //... } } then defined in //MyClass.cpp int Method1(double d) { ... } int Method2(double d) { ... } This project compiles cleanly and is a dependency for a ui project which uses MyClass. The functions were previously member functions of MyClass, but were moved to namespace since it was more appropriate. My problem is the ui project complains when it gets to the linker: 1network.lib(MyClass.obj) : error LNK2001: unresolved external symbol "int __cdecl network::Method1(double)" (?INT@ds@sim@@YAHN@Z) 1network.lib(MyClass.obj) : error LNK2001: unresolved external symbol "int __cdecl network::Method2(double)" (?CINT@ds@sim@@YAHN@Z) What am I doing wrong?

    Read the article

  • ReferenceError: Error #1008 Class is ambiguous

    - by Dimitree
    I have a As3 file and I get a runtime error: ReferenceError: **Error #1008**: Tooltip is ambiguous; Found more than one matching binding. I have a class named Tooltip and also a symbol in library with linkage class: Tooltip and Base Class fvg.Tooltip (fvg is the name of the package). Why I get this conflict?

    Read the article

  • Grails XOM linkageerror - SAXParserException

    - by Stefan Kendall
    Possibly related: http://stackoverflow.com/questions/2762439/grails-attempting-to-include-htppbuilder-linkage-error I'm trying to include XOM in my grails project. How do I know which dependency library I need to exclude? I'm lost here. dependencies { build('xom:xom:1.1') { excludes "xml-apis" } } Error: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/xml/sax/SAXParseException" at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:33) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20) at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.groovy:124) at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.groovy) at grails.util.PluginBuildSettings$getPluginInfos.callCurrent(Unknown Source) at grails.util.PluginBuildSettings.getPluginInfo(PluginBuildSettings.groovy:160) at grails.util.PluginBuildSettings$getPluginInfo.callCurrent(Unknown Source) at grails.util.PluginBuildSettings.getPluginInfoForSource(PluginBuildSettings.groovy:195) at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:303) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:820) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:513) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:489) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:466) at _GrailsEvents_groovy.run(_GrailsEvents_groovy:54) at _GrailsEvents_groovy$run.call(Unknown Source) at _GrailsArgParsing_groovy$run.call(Unknown Source) at _GrailsArgParsing_groovy.run(_GrailsArgParsing_groovy:29) at _GrailsArgParsing_groovy$run.call(Unknown Source) at _GrailsInit_groovy$run.call(Unknown Source) at _GrailsInit_groovy.run(_GrailsInit_groovy:38) at _GrailsInit_groovy$run.call(Unknown Source) at Help_.run(Help_.groovy:27) at Help_$run.call(Unknown Source) at gant.Gant.processTargets(Gant.groovy:494) at gant.Gant.processTargets(Gant.groovy:480)

    Read the article

  • C callback functions defined in an unnamed namespace?

    - by Johannes Schaub - litb
    Hi all. I have a C++ project that uses a C bison parser. The C parser uses a struct of function pointers to call functions that create proper AST nodes when productions are reduced by bison: typedef void Node; struct Actions { Node *(*newIntLit)(int val); Node *(*newAsgnExpr)(Node *left, Node *right); /* ... */ }; Now, in the C++ part of the project, i fill those pointers class AstNode { /* ... */ }; class IntLit : public AstNode { /* ... */ }; extern "C" { Node *newIntLit(int val) { return (Node*)new IntLit(val); } /* ... */ } Actions createActions() { Actions a; a.newIntLit = &newIntLit; /* ... */ return a; } Now the only reason i put them within extern "C" is because i want them to have C calling conventions. But optimally, i would like their names still be mangled. They are never called by-name from C code, so name mangling isn't an issue. Having them mangled will avoid name conflicts, since some actions are called like error, and the C++ callback function has ugly names like the following just to avoid name clashes with other modules. extern "C" { void uglyNameError(char const *str) { /* ... */ } /* ... */ } a.error = &uglyNameError; I wondered whether it could be possible by merely giving the function type C linkage extern "C" void fty(char const *str); namespace { fty error; /* Declared! But i can i define it with that type!? */ } Any ideas? I'm looking for Standard-C++ solutions.

    Read the article

  • C++ linkage error . What am I doing wrong ? [migrated]

    - by nashmaniac
    So, this is the first time I actually separated a single program into a header and two .cpp files . But I think I am getting an linkage error . Heres how the directory looks . (heres a link to my image I dont have enough rep to post image in the question) http://i.stack.imgur.com/sbT4V.png The main.cpp is my main source file where all the calling functions and other important stuff goes . In functions.cpp I have all my functions , in the coordin.h file I have the function prototypes and structures and Constants . Everything is ok no typo nothing I have checked everything . But I am getting an undefined reference to function error. I have included the coordin.h file too . Do you think the functions.cpp file needs to go somewhere else I mean is the compiler not looking inside that file ? Thanks !

    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

  • STL Static-Const Member Definitions

    - by javery
    How does the following work? #include <limits> int main() { const int* const foo = &std::numeric_limits<int> ::digits; } I was under the impression that in order to take an address of a static const-ant member we had to physically define it in some translation unit in order to please the linker. That said, after looking at the preprocessed code for this TU, I couldn't find an external definition for the digits member (or any other relevant members). I tested this on two compilers (VC++ 10 and g++ 4.2.4) and got identical results (i.e., it works). Does the linker auto-magically link against an object file where this stuff is defined, or am I missing something obvious here?

    Read the article

  • Makefile automatic link dependency ?

    - by Kuang Chen
    It's easy to let program figure out the dependency at compile time, (with gcc -MM). Nevertheless, link dependency (deciding which libraries should be linked to) seems to be difficult to figure out. This issue become emergent when multiple targets with individual libraries to link to are needed. For instance, three dynamic library targets t1.so, t2.so and t3.so needs to be built. t1.so needs math library (-lm), while t2 and t3 don't. It would be tedious to write separate rules. A single rule requiring the three targets linked with math library saves the trouble. However, it causes inflation of target size since math library is unused for t2.so and t3.so. Any ideas?

    Read the article

  • Unable to create unmanaged object using new keyword in managed C++

    - by chair79
    Hi all, I've created a class with a boost::unordered_map as a member, Linkage.h #ifndef LINKAGE_H #define LINKAGE_H #include <boost/unordered_map.hpp> class Linkage { private: boost::unordered_map<int, int> m_IOMap; public: .... }; Linkage.cpp #include "stdafx.h" ... // methods and in the managed side of C++, I try to create the pointer of the obj: private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { Linkage* m_pLink = new Linkage(); ..... } However this produces errors: Error 4 error LNK2005: "private: static unsigned int const boost::detail::type_with_alignment_imp<4>::found" (?found@?$type_with_alignment_imp@$03@detail@boost@@$$Q0IB) already defined in Proj_Test.obj Linkage.obj ..... Error 7 fatal error LNK1169: one or more multiply defined symbols found Could anyone explain to me pls? Thanks.

    Read the article

1 2 3 4 5 6  | Next Page >