|
Yes. I have developed a static library on top of a 3rd party API, which uses DLLs.
The reason for the static library is to remove the single source dependance on a single supplier.
Is this the problem and can it be resolved?
|
|
|
|
|
AFAIK you can nor link the MFC statically and per DLL at the same time.
When your app statically links MFC and also links a library that in turn dynamically links the MFC, you are in trouble. I do not know a way to solve this problem. But that does not mean ther is no way.
What I always did was changing the setting for one or the other.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Did you try /NODEFAULTLIB:LIBCD ?
John
|
|
|
|
|
Under what linker option do I place this setting?
|
|
|
|
|
If you are using VC6 under the link tab (in project settings) if yo go to the input category and put LIBCD in the ignore libraries the compiler will put it in the linker options for you. You will see a line in the Project Options box at the bottom of the dialog that states /nodefaultlib:"LIBCD"
John
|
|
|
|
|
I place the option under Ignore Specific Library and still get the warning.
|
|
|
|
|
I'm sorry if I am wasting your time. In the past that has always worked for me. Try adding a .lib so the entry is LIBCD.LIB. Is there any other libraries listed in the box? If so you must seperate them with a comma.
John
|
|
|
|
|
Just to recap. I am creating a Static Libray which uses calls to a 3rd party API.
I have a test program, Windows Dialog MFC application and has the option set 'Use MFC in a Shared DLL'
in the Ignore Specif Library is set to:
/NODEFAULTLIB:WAPI_AIM.LIB;api_mil.lib
Where api_mil.lib is the 3rd party library and WAPI_AIM.LIB is my static library.
|
|
|
|
|
sweep123 wrote:
the Ignore Specif Library
You are using Visual C++.Net? I use VC6 but also have a copy of Visual Stusio.NET.
I believe that you should put in the Ignore Specific Library box only LIBCD.LIB and nothing else. And you should never put /NODEFAULTLIB: in that box. If you need to ignore other libraries seperate the list with semicolons. If you look at the command line tab you will see excatly what command that visual studio is generating for the /NODEFAULTLIB: parameter.
John
|
|
|
|
|
I am using Visual Studio .Net.
I did place WAPI_AIM.LIB in the Ignore Library Option, but still get the same warning.
|
|
|
|
|
You do not want to ignore WAPI_AIM.LIB or api_mil.lib
because that is what you are linking with. This statement tells the linker not to use these libraries. You want to ignore LIBCD.LIB instead because that is the one causing the problem.
John
|
|
|
|
|
OK got it.
Thanks, the warning has now gone.
|
|
|
|
|
Glad to be of help..
John
|
|
|
|
|
i am using a visual studio add in.
in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app,
in both cases, even if i use or don't use AFX_MANAGE_STATE(AfxGetStaticModuleState()); i get a pointer to the add in app
and not the pointer to the visual studio (exe)
how can i retrieve the pointer to the visual studio exe???
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Can you give me an information about how to use af_irda.h in C++ ?
I think that I could access my cell phone via Irda connected to my PC using af_irda.h. Isn't it correct ?
I've downloaded some examples and articles, but they are for Windows.CE not Windows XP. Can you give me a sample code to do that ?
I've tried to include af_irda.h but there were few errors when I run the application. Can I use af_irda.h in Visual C++ 6.0 ?
Or there any other way to access my cell phone in simple and direct way ?
Thanks a lot.
|
|
|
|
|
Communication between the phone and the PC can be established in the following ways:
1.RS232 serial port
2.IrDA
3.Bluetooth
Whether you believe or not all three ways work the same way, namely by sending so called AT commands to the phone and receiving an answer.
I would recommend you to look up Device I/O in the PlatformSDK, especially functions like ReadFile and CreateFile,WriteFile, and ReadFile (yes, they are called file!).
they will tell you have to communicate over the serial port.
You can use the same functions for communicating over IrDa and Bluetooth, because both implement an RS232 serial interface. From the point of view of your code, the only difference is that you use the device's name when opening them with CreateFile (e.g. IRDAx or BTHx instead of COMx).
Peter Molnar
|
|
|
|
|
Hi Peter, I'm a begginer in this, i know that this section is For C++ only, but I have the same problem to comunicate to my cell phone, and I'm very confused now.
I have already try CreateFile,ReadFile,and WriteFile Function as you tell us on this message board.
I try those using Visual Basic by declaring CreateFile Function with kernel32.dll as the library.
the problem is there is no file created when the programm's running, even on my drive C:\.
this is my code.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
CF=CreteFile("C:\tester.txt",GENERIC_WRITE, _
FILE_SHARE_READ,0,CREATE_NEW,FILE_ATTRIBUTE_ARCHIVE,0)
if CF<>-1 then
'write file function
else
msgbox "Error Message"
end if
CloseHandle(CF)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I have try to change the first parameter with "\\.\c:\tester.txt" or "\\.\irda1\tester.txt" but the result is same, there's nothing happen.
I hope you can give me a sugestion or maybe you can tell me where i can find the example programm in VB or VB.NET
Thank you Very Much!!! and im sory, my english is not very good;P
|
|
|
|
|
hi peter, i have try again and it works,the programm can
detect my irda device on com3. but when i start to send the
AT Command to the phone by using WriteFile function,
there's no reaction.
and then i want to translate the working code into VB.net,
but the result will not correctly why???
can you help me????please
|
|
|
|
|
Hi Ivan,
sorry for not answering for a long time but I was away from my desk.
As for porting C++ code to VB.NET, I am not familiar it but I definetaly know -just as you write- that it is possible to call Win32 API functions from VB.NET code.
Comments on your code:
1.The first param of CreateFile is a string like "COM1" or any other string describing the communication device's name. Inspite of the function name NO file is actually created. Use GENERIC_READ | GENERIC_WRITE access flags.
2.CreateFile returns a handle which identifies the opened communication port. Using this handle you can call WriteFile to send AT commands to the device and later on ReadFile to check for response.
3.In order to not block your channel forever, and receive your info you should poll the port for answer (of course only after you have successfully sent to it an AT command) in a loop with ReadFile for a pre-defined, device specific period of time. You should collect the returned info in a buffer.
4.A successfully opened device that you communicate with ALWAYS returns a response regardless of whether the given AT command is understood by the device or not.
Possible responses are "\r\nERROR\r\n" if the AT command is not known to the device, or "\r\nSOME INFORMATION\r\n\r\nOK\r\n" if the sent AT command is supported, where \r\n is 0x0d and 0x0a.
Peter Molnar
|
|
|
|
|
hi peter, finally i've made it with visual c++ 6.0
but, this is will only success if i use windows XP as the operating system,
and failed when i try those in win2000pro or win 2000 server.
maybe i should told you that my irda device can only be attached to the usb, not to the serial port. so i can't use my code to send or recieve any information.
and maybe you can told me for the suitable path that i can use for accesing this usb irda device, instead of com3 that will only automatically show up (added to the com port list) when i beam my cellphone's irda in windows XP OS not to win 2000.
i have try what you told to write IRDAx as the path but this's failed
please help me
thank's very much!
note:
i also email you this post.;)
|
|
|
|
|
HI,
IrDA really implements a VIRTUAL serial port by means of its device driver, and it is also the device driver which is responsible for the device to be recognized by the OS, and XP has definitely more built-in drivers than previous OSs. Virtual means that an IrDA device can really be manipulated like a real COM port although it is not.
Since I dont have any real experience specifically with IrDA I suggest you to consult the device manufacturer's documentation.
Peter Molnar
|
|
|
|
|
Hi,
I have the following scenario:
class CFoo
{
public:
int Foo();
static CFoo * CreateFoo() { return new CFoo; }
};
void * GetNewFooHandle() { return (void *) CFoo::CreateFoo(); }
int FooFoo(void * fooHandle) { return ((CFoo *)fooHandle)->Foo(); }
I don't it done with the declarations (I played around with __cdecl / extern "C" etc.)
Any pointers? (Or a sample would be nice)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
what kinda of error are you getting.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Sorry for the late reply - I got it working.
Error was function not found at linkage.
Found out that in a .cpp file, you can call CPP stuff even in an funciton that is declared extern "C"
So things look like this:
#ifdef __cplusplus
class CFoo { ... };
#endif
#ifdef __cplusplus
extern "C" {
#endif
void * FooCreate();
int FoFoo(void *);
#ifdef __cplusplus
}
#endif
CFoo * CFoo::CreateInstance() { ... };
int CFoo::Foo() { ... }
extern "C" void * FooCreate() { return (void *) CFoo::CreateInstance(); }
extern "C" int FooFoo(void * f) { return ((CFoo *)f)->Foo(); }
Cool!
I'm not sure if this is a VC6 only thing - but that shouldn't hurt me much
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
Does C has classes?
Sonork 100.41263:Anthony_Yio
|
|
|
|