Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Themis

@Themis
About
Posts
47
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Compiling a single dll from several .lib
    T Themis

    I have already added the dependencies in the dll properties. However I am not sure what you mean when you say "you will need to explicitly export all of the functions and variables from the various .LIBs, from the DLL". I export symbols (classes/functions) using dllexport in each project. Do you mean that I have to do anything more in the dll project? The fact is that without referencing a class from the dll project it will not be linked by the linker to the target dll. I am wondering if I can bypass this linker "optimization" and make the linker unconditionally add a class' code in the dll. Cheers, Themis

    C / C++ / MFC

  • Compiling a single dll from several .lib
    T Themis

    Yes I want to create a super-DLL that others (apps or dll) can link and refer to its included objects. However I don't want to merge the several .lib projects into one .dll project to generate my dynamic library as my .libs do not match conceptually, hence I prefer to have them separate in the Solution Explorer. Think of a large base dll with several support projects, like networking, serialization, utilities etc. all merged in a single project_base.dll. Cheers, Themis

    C / C++ / MFC

  • Compiling a single dll from several .lib
    T Themis

    Hi, I am trying to compile a single dll from several static library projects in VS2005. However as it seems the compiler does not link the .lib libraries to the dll unless they are referenced in the dynamic library project. Is there any way (linker flag?) that I can aggregate several .libs in a dll file without having to reference their classes/functions/vars? Thanks, Themis

    C / C++ / MFC

  • Deploying a VC++ application on a target machine
    T Themis

    If I chose static linking was Windows supposed to embed the library code I use in my binaries so that I don't need dlls at all? Anyway I'm using shared dll. The operating system in both machines is WinXP SP2. Any idea what are these manifest files I got produced with each one of my dlls? Do I have to distribute them along with my app? Themis

    C / C++ / MFC

  • Deploying a VC++ application on a target machine
    T Themis

    Hi, I've tried to build a VC++ program in VS2005. I built it in release mode and although it runs correctly in my machine, when I try to run it in a machine which does not have VS2005 the application instead of running shows an error message box saying: "The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." My application is composed of an exe file and several dlls which I copy to the target machine. Do I have to copy anything else to the target machine? Thank you.

    C / C++ / MFC

  • Code-Generation options
    T Themis

    Hi, I was wondering what is the difference of "Multithreaded" and "Multithreaded DLL" options on the Code-Generation tab of the VC++. I used to compile my application (composed out of several dll files) with "Multithreaded" (default option when migrated my app from VS2003 to VS2005) and it crashed randomly (some times it could even run smoothly for some reasonably long time). However when I switched the option to "Multithreaded DLL" the random crashes didn't occur any more. Thank you.

    C / C++ / MFC

  • template classes & dlls
    T Themis

    Hi there. I have two projects in a solution (VS8.0) and the first has a dependency on the other. Both projects produce dlls. Now I want to define a simple singleton and use it from both dlls. So the code is easy: class _MyProject_Export BuilderFactory : public util::DllFactory { public: static BuilderFactory& Instance(void) { static BuilderFactory singleton; return singleton; } }; Ok we have a BuilderFactory class that it inherits from another class and just define a static member Instance to get reference to my singleton. Of course having such a code you are going to templatize the code in the following fashion: template class Singleton { public: typedef T SingletonType; static T& Instance(void) { static T singleton; return singleton; } private: Singleton(void) {} Singleton(const Singleton&); Singleton& operator =(const Singleton&); virtual ~Singleton(void) {} }; typedef Singleton< util::DllFactory > BuilderFactory; Both example compile successfully, however the latter doesn't work! Just can't understand why. I came to believe that in the latter case two different instances exist in my program. As I'm registering builders in the factory from on dll and the second doesnt have any. I suspect that something has to do with exporting of symbols as I don't export anything in the latter case, but what am I supposed to export, the typedef? Any ideas?

    C / C++ / MFC

  • dll project does not output a .lib file
    T Themis

    Yeap actually that was the case, I forgot to export the symbols. Thanks for the tip, I could have gone days without realizing it.

    C / C++ / MFC

  • dll project does not output a .lib file
    T Themis

    Hi, I have a solution with some projects that produce dlls. However some of these projects also generate a .lib file for their respective dll in order for another project to link with dll at linking-time. However some other dll projects do not provide me a .lib file. Why does this happen? At first I thought I missed an option at the property page of the latter projects but this is not the case, as I compared the property pages finding no such differences. What should I do in order for all my dll projects provide me with a lib file? Thank you. PS - I'm using VS2005

    C / C++ / MFC

  • importing template classes from dll
    T Themis

    Hi, I 'm trying to import a template class from dll A to another one, dll B, where I'm subclassing it and instantiating it. However I get the following linking error: xmlCoreBuilder error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MAGE::Builder::Builder(void)" (__imp_??0?$Builder@VScene@MAGE@@@MAGE@@QAE@XZ) referenced in function "public: __thiscall xmlCoreBuilder::SceneBuilder::SceneBuilder(void)" (??0SceneBuilder@xmlCoreBuilder@@QAE@XZ) In the following error Builder is the base template class defined in dll A and SceneBuilder is a specialized sub-class of the former defined in dll B. I get the linking error when creating an instance of the sub-class in dll B: xmlCoreBuilder::SceneBuilder* b = new xmlCoreBuilder::SceneBuilder; I'm suspecting that I might have that problem because I export a template class, but I'm not sure. Can you think of anything? Thank you, Themis

    C / C++ / MFC

  • scripting actions in VS
    T Themis

    Hi, I want to use lex/yacc in my project and I'm curious if Visual Studio can automate the following process. When I ask to build my project I have to call lex and yacc with their corresponding input files. These programs will generate some .c .h files that I want to be inserted into my project and then compile these files. Is there any way I can script this process in VS in order to avoid doing it manually. Thanks -- modified at 18:25 Monday 7th November, 2005

    C / C++ / MFC

  • std::multimap & std::find()
    T Themis

    Yes I just read my message in firefox (browser I use) and then reloaded it in IE (just because of curiosity) and saw that in IE code blocks are printed red and the rest black. However in firefox everything is printed in black until a code block begins, then everything below that point prints in red, even after the code block end. Anyway that just a note. Themis

    C / C++ / MFC

  • std::multimap & std::find()
    T Themis

    Hello, lets take a look at the STL. We have std::multimap pairs; void remove(sth* s1, sth* s2) { std::multimap::iterator i; if ((i = std::find(pairs.lower_bound(s1), pairs.upper_bound(s1), std::make_pair(s1, s2))) != pairs.end()) pairs.erase(i); } Well that doesn't work. I get MANY template compile errors (really hard to read, and rearly make any sense). I'll give you a small sample: f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=std::pair ] f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=std::pair ] f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=std::pair ] I think you get the idea. All the compile errors point inside std::find() where the arrow points: template inline _InIt find(_InIt _First, _InIt _Last, const _Ty& _Val) { // find first matching _Val for (; _First != _Last; ++_First) ----> if (*_First == _Val) break; return (_First); } I just can't understand where the problem is. Everythink looks fine to me, but obviously it isn't. Anyother idea how am I supposed to erase a single pair from a std::multimap()? I can only find functions that erase all pairs for a specified key but I just need to erase one of those pairs given a specified mapped_value. That all, Themis PS - std::remove() also doesn't work as it relies on std::find() (at least in VS .NET 2003 implementation) -- modified at 6:08 Friday 23rd September, 2005 PS2 - I don't know if you are already aware of that but the code tags of the forum are not rendered properly with the Firefox Brows

    C / C++ / MFC

  • time in msec
    T Themis

    Thank you all for you answers!

    C / C++ / MFC

  • Why I shoun't call CView::OnPaint() for painting messages
    T Themis

    It's easy if you know what you have updated in each call. Instead of calling Invalidate() call InvalidateRect(). It takes as argument the area that you want to invalidate. It will update only that area this way if only a small portion of your view has changed you won't redraw everything. Themis

    C / C++ / MFC

  • Why I shoun't call CView::OnPaint() for painting messages
    T Themis

    In order to avoid blinkings try to invalidate only the area you are updating instead of the whole paint area. Themis

    C / C++ / MFC

  • time in msec
    T Themis

    Hi could you please remind me how I can get time in msec? time() returns time in sec but I need more precision. Thanks

    C / C++ / MFC

  • 'needs to have dll-interface' warning
    T Themis

    Hi, I need some help with dlls. It's my first time writting dlls and I have a minor problem. #ifdef MYPROJ_EXPORTS #define _myprojExport __declspec(dllexport) #else #define _myprojExport __declspec(dllimport) #endif class _myprojExport MyClass { ... protected: typedef std::list StringList; StringList mylist; }; As you can see on the above code I have MyClass which is a simple class that I export. When mylist member is missing everything is compiled smoothly, however when I have mylist member variable on the class I get the following warning from my compiler (VS .NET 7.1). warning C4251: 'MyClass::mylist' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'MyClass' with [ _Ty=std::string ] How can I create a dll-interface for std::list? I don't have to export std::list the client will find its implementation in . How should I declare mylist in order to get rid of these warnings? Thanks in advance, Themis

    C / C++ / MFC

  • The old time classic dll questions!
    T Themis

    Hi, as you 've probably guessed I tring to create a dll and use it in another program. So I've search some articles and I 've found a few interesting things. However when I try to execute a simple program it doesn't seem to work. Let's be a bit more specific. #include "stdafx.h" #include "greet.h" #include BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } // This is an example of an exported variable GREET_API int ngreet=0; // This is an example of an exported function. GREET_API int fngreet(void) { return 42; } // This is the constructor of a class that has been exported. // see greet.h for the class definition Cgreet::Cgreet() { return; } void Cgreet::run(int arg) { printf("Hello World!\n"); } The above code is produced by VS 7.1 when asked to create a new win32 console project and dll is selected. I 've also added another method to the class created. I also give you the header file VS created. #ifdef GREET_EXPORTS #define GREET_API __declspec(dllexport) #else #define GREET_API __declspec(dllimport) #endif // This class is exported from the greet.dll class GREET_API Cgreet { public: Cgreet(void); // TODO: add your methods here. void run(int arg); }; extern GREET_API int ngreet; GREET_API int fngreet(void); Well now I create a simple win32 console project with the following code #include #include int main() { HMODULE hdll = LoadLibrary("greet.dll"); if (hdll != NULL) { typedef int (*PFUNC)(void); PFUNC greet = (PFUNC)GetProcAddress(hdll, "fngreet"); if (greet != NULL) { // Now we can call the function in the DLL printf("greet.dll returned: %d!\n", greet()); } else printf("Loading function 'fngreet' failed!\n"); } else printf("Loading library 'greet.dll' failed!\n"); } The output of execution is: 'Loading function 'fngreet' failed!\n' I 've also seen in another post someone asked functions like "_fngreet" but that also didnt work. What am I doing wrong? Looking the code with the debugger I see in my main program that hdll pointer gets a weird address. hdll 0x10000000 {unused=9460301 } HINSTANCE__ * That's what the debugger says about hdll and

    C / C++ / MFC

  • Global Objects Constructor
    T Themis

    If you set a breakpoint at the constructor the debugger will see it. If I use the global var in my main program then the constructor is called. However what I want is not to use this object. I dont even want to know its existance out of my .lib, I just want to execute sth just before main begins. Themis

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups