|
Hello all. How can I export a template class from a simple DLL? I'm using Visual C++ 7.
One day you'll find
that I have gone,
for tomorrow may rain, so
I'll follow the sun...
|
|
|
|
|
A template is an abstraction and cannot be exported. You can either declare explict types of uses or write a non-template base class, export that and use the template as a wrapper. (I've used both methods.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You can only export template instantiations. The syntax is odd, and it's not standard C++ (the compiler tells you it isn't)
Good music: In my rosary[^]
|
|
|
|
|
I think that we have to wait for visual studio 2006 or something, since exporting templates from a object file is still not supported in VS2005 . Support for the standard and especially templates is very great though.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Templates are kinda inline functions, which cannot be exported!
Don't try it, just do it!
|
|
|
|
|
I have a toolar resource to incorporate with my SDI Application and in mainfrm.cpp I attempt to create it by:
if(!m_wndToolBarStd.Create(this, WS_CHILD | WS_VISIBLE
| CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS
| CBRS_FLYBY | CBRS_SIZE_DYNAMIC, IDR_TRUACT) || !m_wndToolBarStd.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // Fail to create
}
It compiles fine, but when I try to start my application I get a couple error messages with "Debug Assertion Failed". (For reference, the assertion failures were at winocc.cpp/line 301 and afxwin2.ini/line 118.) Any input on how I can get this tool bar to work?
Danny
|
|
|
|
|
Hi there,
I'm looking for a way to create a new code/data section with a #define directive.
The problem is, that the compiler does not allow #pragma directives within a #define directive.
Example:
#define SECTION() #pragma data_seg( ".x" )
Is there another solution?
Regards,
Alex
Don't try it, just do it!
|
|
|
|
|
What about:
#define SECTION_NAME ".X"<br />
#pragma data_seg( SECTION_NAME )
I am pretty sure anyplace you did not WANT the named section, you could just use
#pragma data_seg()
I am pretty sure this resets it to the default data segment or has no effect if the data segment was not changed from the default in the first place.
|
|
|
|
|
The problem is that I want to set a new named section!
It is quite easy:
I create a new section with an array inside, which consists of many arrays from multiple cpp files.
When compiling I merge the section with the data section and so it's possible to read the whole array from only one function (it's the same thing as the CRT does with e.g. constructors of static classes).
I want to use a macro for that new section statement and the start of an array because it saves time when typing the code .
Don't try it, just do it!
|
|
|
|
|
There is no super shortcut, but you can organize these. This is an example of how I do it:
#ifndef _TEXTSEG<br />
#define _TEXTSEG(name) ".text$" #name<br />
#endif<br />
<br />
#ifndef MY_CORE_SEG<br />
#define MY_CORE_SEG _TEXTSEG(MYS_CORE)<br />
#define MY_GDI_SEG _TEXTSEG(MYS_GDI)<br />
#endif
Then at the top of the source files I add the following as appropriate:
#ifdef MY_GDI_SEG<br />
#pragma code_seg(MY_GDI_SEG)<br />
#endif
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I need to be able to convert a small (say 150px x 30px) 24-bit BMP image to some sort of compressed image - say GIF, JPG or PNG to use on a web page.
I have tried compiling the latest version of GD2 but it leaves a lot to be desired and its probably not quite compatible with VC5. It compiles with oodles of warnings then fails to link. The lib batch file says it works but compiles a microscopic LIB file. I've tried the extern "C" wrappers and stuff but to be honest if the code is this messy then its not what I need for a quick solution. Its far too complex.
I need something fairly simple just to do the basic job - no frills. Perhaps along the line of BMPtoGif(FILE* stream) or BMPtoGif(object*). I'd prefer code which doesn't load from file but could hack it if needed as I already have the BMP in an buffer in memory.
I see there's a definite lack of GIF routines thanks to UniSys - even though the patents have now expired so I expect there ought to be shed loads of BMP2PNG code out there. Hours of Googling have drawn few actual examples of code in the public domain.
Anyone got any pointers to something fairly simple. The app I'm writing is a freeware Win32 CGI console app.
Failing that it means a week or so reading the GD2 code and extracting the relevant parts that work and create my own libarary. I have a feeling its gonna go that way.
|
|
|
|
|
We have routines that do exactly this for our web-based charting module. From memory to memory or disk. Reply to this message so we can start an off-board email and perhaps I can get you the code.
onwards and upwards...
|
|
|
|
|
OK thanks - much appreciated. I was looking for public domain code as I almost certainly won't be selling the application it will be freeware. Its hard enough even giving software away!. I can't even recall anyone even emailing to say "thanks" for any of the stuff I've written!. Good job its an interesting hobby.
I would have thought there would be some GNU Linux-based routines suitable for conversion to Win32.
The code is intended for a small freeware, web-based CGI countdown counter for Apache/Win32 which I have been writing as an excercise in moving away from VB to Visual "C". The counter is working fine but the 24-bit BMP images produced, at 13-15k per image are a bit large - especially if you have several on a page.
Regards
PS Its my first post on this site so I'm not sure if you'd get acess to my email through it. I'd rather not publish it on the net as I already get about 300 spams a day!.
|
|
|
|
|
there are a few articles on Code Project that might be able to help (you'll probably have to convert them back to VC5, though). see the Bitmaps and Palettes section.
or, i know where you can find a nice inexpensive DLL...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks. I needed to keep the application as a monolithic exe rather than start getting complex about distribution with DLLs. Its only a 60kb freebie and the main gain I am going to get out of it (possibly the only gain) is as one of a first few programming exercises in Win32 CGI. I am tempted to leave it "as is" with fairly large BMP files as output but it seems a bit amateurish not to finish it off and make something useful for people to use by compressing the output files.
I'm fairly happy converting between vb and various flavours of C but some of the code I've seen so far has been incredibly messy and disjointed. Scouring through the GD2 source code is mind-boggling. Although I'd certainly not want to pick fault with anyone who does excellent service to public domain the code bundle is scary to say the least if you're not a graphics programmer! lol
If you wanna have a butcher's its at http://daysto.amadis.sytes.net - a CGI countdown counter for Apache
|
|
|
|
|
you might also check out ImageMagick. it does a lot of formats, and picking out the code you need is, not exactly easy, but definitely do-able.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hey, thanks. That looks quite promising.
I'm baffled that in the years of VC++ GIFs and BMPs that someone hasn't put together something quick fairly simple like an idiot-proof function lib. Searching Google its like PNGs and BMPs were only invented 12 months ago!. Top marks to the GD2 guys but its a bit too hardcore for me to compress one image. I'm pretty sure I'll have to strip the guts out of some other code and rewrite a small library.
|
|
|
|
|
Hi,
I want to process LZ compression on some buffer of memory.
As far as I know LZExpand package enables to read only the zipped files.
Can anybody give me a hint?
Thanks
DavidR
|
|
|
|
|
Get and use the zlib library.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
When I read about the bug last week, dummy me thought they'd already fixed it. However, for controlled data, I don't think it's a problem.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a problem
I finished programming my c++ software
When I run the software, it is working normaly but when I exit the dialog using DestroyWindow() an error message appears saying: "Debug Assertion Failed!" winhand.cpp and line 229
Then, the software exit like it is suppose too but how can i get rid of this message
help plz it is very bothering
and i couldn't enter my name and e-mail to send this message for a reason although i am halawlaws and my e-mail is ahalwany@hotmail.com
thx
Halawlaws
|
|
|
|
|
Halawlaws wrote:
...but when I exit the dialog using DestroyWindow()...
Why are you doing this? Is this a modal dialog?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Try exiting the dialog using EndDialog(). Also, sometimes it is helpful to look at the code the error message is pointing you to, in this case winhand.cpp/line 229. And by the way,
Halawlaws wrote:
Then, the software exit like it is suppose too
The software is not exiting like it is supposed to. The software is aborting becuase of a debug assertion failure. If, for example, when exiting this dialog you were supposed to return to another part of the program, your software would still completely exit.
I can't tell anything more without actually seeing some of your code. Hope this helps!
Danny
|
|
|
|
|
Hey Dany thx man EndDialog(0) worked my program is now perfect but i still didn't know why this assertion problem occured
regards
Halawlaws
|
|
|
|