|
Hi
Thanks for reply.
Please refer following link for information regarding dangling refernces.
" Windows vs. Unix: Linking dynamic load modules " http://cphoenix.best.vwh.net/winvunix.html
I have written one Application which is attached to one shared memory.
Pointer " dp " points to that shared memory.
Also I have written one DLL which provides some functions. These functions refers shared memory thr' dp ptr.
Since DLL cann't access ' dp ' (though it is Global pointer ) directly , I have written one more function init_dp_dll_ptr in DLL like below.
static void *dp_dll;//This is local ptr of DLL.
__declspec (dllexport) init_dp_dll_ptr (void *dp_ptr)
{
dp_dll = dp_ptr;
}
But when I call init_dp_dll_ptr() from Main Application, I got segmentation fault at line " dp_dll = dp_ptr; "
I am not a VC progrmmer expert. Please let me know what wrong i have done.
Regards,
Praks
|
|
|
|
|
The concept of what you are doing is fine. I'm a little perplexed. I can't find anything on "segmentation fault" in the MSDN library. Here are some tips in case you haven't thought to try this.
I assume dp_dll is a pointer to a data structure or object. I assume you are using visual studio to setup your projects and Dlls. We do something very similar in our application here at work. We have one main MFC application which contains the GUI and many DLLs that contain some other levels of functionality. one of our Dlls, we call CommonDll and this is where set setup any global pointers that need to be available to all. So common utility functions are exported, the same way you have done so. Of course there are other interface functions that allow other Dlls to get a copy of the pointer. If your app is multithreaded, don't forget to use a CriticalSection or mutex to prevent threads from getting the pointer while it is being initialized.
First, check your project properties. Ensure that C/C++ / Code Generation / Struct member alignment is the same for all of your projects. We ran into major run time problems with this.
What kind of DLL have you setup? We seem to be able to do what you are doing (initialize a global pointer with an exported func within a Dll), very easily with an MFC extension Dll. Regular Dlls are different and have some special requirements for setting up your functions. You're function appears to be setup for an extension Dll so hopefully that is how you have set up your Dll. If not, recreate the Dll project as an MFC extension dll. By default, my visual studio .net selects regular dll and then I have to specifically remember to change this while walking through the project creation wizard.
There is plenty of documentation on dlls within the MSDN library if you need more to read. Just search on regular dll or extension dll.
Hope some of that points you in the right direction.
|
|
|
|
|
How can i exit Windows in StandBy
and in Suspend to Disk ?
The ExitWindowsEX didn't have a flag for it !
Thanxs
rajesh
|
|
|
|
|
Narf!
The SetSystemPowerState function suspends the system by shutting power down. Depending on the ForceFlag parameter, the function either suspends operation immediately or requests permission from all applications and device drivers before doing so.
The SetSuspendState function suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).
|
|
|
|
|
Please Help!!!!!!
i just cannot Handle any mouse movements on the status area icon that i created using Shell_NotifyIcon
Seejoy Jose
|
|
|
|
|
Hi,
There is an Sample source regarding this on the section "The Taskbar" @ msdn. Have a look @ it.
Sujan
|
|
|
|
|
Dear All,
Platform: Windows 2000
Developed on: MS VC++ 6.
I have a client-server application in which client application communicates with server application via IPC mechanism. Both of the applications are build in Debug mode. I want to debug the communication b/w them.
For instance, client calls an function "ReadString" which communicates with the server to get the string. I need to debug this flow.
For this I am debugging the client by attaching the server process (in VC++ UI goto Build->StartDebug->attach to process )
I have placed the debug points at the server application at the point where the readstring from server gets called. But when i try to do this, it doesnot debug rather shows assembly part. And then I have to stop debugging.
Can somebody tell me the exact procedure to debug the same. Or alternatively what may be the reason for improper debugging. Please suggest.
Thanks and Regards,
Rohit
|
|
|
|
|
Make sure the PDB files are in the same folder as the EXE files.
If they are not, 'symbols' can not be located, and all you get when you break is assembly.
|
|
|
|
|
Hi Friends,
I am creating software for creating fonts. Let me know wheather is there any SDK's for developing fonts for Microsoft Windows.
Thanks & Regards,
Promise
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
Hi guys,
is it possible to define partial specialisation for a class template that contains nontype parameter? I wrote a simple template example and wanted to do a specialisation for char * type. I couldn't figure out how to do it, any thoughts?
My original template class is below:
template<class kind, int stack_size>
class stack {
private:
int count;
kind data[stack_size];
public:
stack (void) {
count = 0;
}
void push (const kind item);
kind pop (void) {
--count;
return (data[count]);
}
};
With push() member function separately defined.
template<class kind, int stack_size>
inline void stack<kind, stack_size>::push(const kind item)
{
data[count] = item;
++count;
}
Now I tried to specialise the class for char *
template<int stack_size>
class stack<char *, stack_size>
{
private:
int count;
char *data[stack_size];
public:
stack (void) {
count = 0;
}
void push (const char *item);
char *pop (void) {
--count;
return (data[count]);
}
};
<br>
inline void stack<char *, stack_size>::push(const char *item) <---- error
{
data[count] = strdup(item);
++count;
}
The part above wouldn't compile properly. I got a compile error when it hits the push() function definition. It says the stack_size is undeclared identifier.
Thanks.
|
|
|
|
|
The correct syntax for the specialized member of stack::push is as follows:
template<int stack_size>
inline void stack<char*,stack_size>::push(const char* item)
{
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thank you, Joaquín
In addition. You can see that only stack::push() was needed to change for the specialisation. I am wondering if the C++ template standard provides a way to directly make a specialisation towrds member functions, without having to rewrite whole class specialised declaration?
Thanks again.
|
|
|
|
|
No, you can't partially specialize a member function. The language allows you only to fully specialize a member function. For instance, the following is valid:
template<>
inline void stack<char*,1024>::push(char* const)
{
} but I'm afraid this is not what you're after, sorry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
I'm into new assignment of sending SMS to mobile phones, I'm just a beginner to this, so please advice me in this regard or send a Visual C++ code to do this and the hardware requirements in detail.
my name is junnybol, and i'm from curacao
|
|
|
|
|
Unfortunately, all free C/C++ libraries for mobile communications, that I know, are designed only for particular type and connection. So I'd like to know:
1. What type of mobile do you have (Siemens, Nokia...?)
2. How do you connect to the mobile (serial line, USB, Bluetooth?)
Robert-Antonio
|
|
|
|
|
The sending of sms must be through a gsm modem that is connected to de com-poort. And one of the important things is that every mobile can receive a sms via my application.
What i know is that u need to use AT-commands, but how in my application i don't know.
my name is junnybol, and i'm from curacao
|
|
|
|
|
Com-port => you need the serial communication library. There's plenty of free c++ serial communication libraries, try google.
For detailed info about AT commands see documentation for partial type of your mobile phone. For example, look at scmxx library for communicating with Siemens mobiles. You can read many useful commands from the scmxx source code . Good luck!
Robert-Antonio
"A piece of paper is an ink-lined plane.
An inclined plane is slope up.
A slow pup is a lazy dog.
Q.E.D.: A piece of paper is a lazy dog."
|
|
|
|
|
SMS sending is done via AT commands specified in the GSM 07.05 norm (google for that). Implementing this yourself is not terribly difficult, but it'll take you some time.
Googling for "GSM 07.05 source code" yields several results, among them Tutanhamon's article Send SMS via RS232 or SMS Gateway, in C#
[^]. Although it is in C#, I guess it won't be hard to translate the interesting stuff to C++.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Hi, I'm newbie with visual c++ and c++ in general. As I told in subject, I have serious troubles getting data saved from listctrl.
|
|
|
|
|
hi,
with listctrl you can get only the text of listctrl's items. GetItemText(...) - parameters of this functions depends of wich view u use listctrl(large icon, small icon, report view....). This func return text as a CString object which you can save it any where you want - in file, in database, in registry .......
|
|
|
|
|
Does anyone know how to remove a dialog box from an application.
clearly erasing it from the .rc file is not enough...
Keep it simple
|
|
|
|
|
Hi,
Delete the class (.cpp,.h) files, the resource, and all the files where it is referenced.
Sujan
|
|
|
|
|
well the problem i m facing is a little strange.....:'( ... the problem occurs in VC provided class called CPushRoutingFrame...the function is Pop().... and the exception is Access violation..
It occurs occasionally and best part is in an empty destructor of one of my Window class.
what could be the problem>>??? please help asap.
shoaib
Hell is full so i m back....
|
|
|
|
|
could you give the lines where the error occured ?
watch also the functions call stack to understand the reason of this exception...
TOXCCT >>> GEII power
|
|
|
|
|
Hi,
Have a look @ the callstack window. It may give more information.
Sujan
|
|
|
|