|
Those xxx_t types are provided by the C runtime library (CRT). Defining _ATL_MIN_CRT means your binary doesn't link with the CRT. Since your code needs the CRT, you get an unresolved symbol. Remove the _ATL_MIN_CRT symbol to fix this.
The help page on LNK2001 has more info.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
If possible, you may also use raw_interfaces_only and raw_native_types with your #import directive, then subsitute _com_ptr_t, _bstr_t, _variant_t with CComPtr/CComQIPtr, CComBSTR and CComVariant.
|
|
|
|
|
Thanks Felix. This will definitely raise me from ATL HELL.
The problem with those #import's - lack of documentation and examples.
I only understood no_namespace, rename_namespace, rename and named_guids (the easiest ones).
All other flags had been complete mystery.
Kirill.
|
|
|
|
|
Mike, thanks for an assurance!!!
I knew that this issue was related to .tlh and .tli files, but could not put a period after my speculations.
Kirill
|
|
|
|
|
Hello,
I am looking for a way to add menu items and toolbar bitmaps through registration of a COM object and using component categories.
I have seen the "WordPad snap-in" sample in MSDN and the interfaces defined here pass HMODULE's to the main application so it can load directly from the dlls resources (specically bitmaps/strings and menus)
I have a problem and a question.
1.) I get error on MIDL(MIDL2139) compiler because HMODULE is of type void or void*...
2.) Should COM objects do this sort of thing? or should all resource items be stored in a main application - this kindof defeats the object of me designing my app + "snap-ins" to make adding functionality a question of simply registering a dll.....
If anyone can show me an example of how this sort of thing can be done
or any pointers you can give me that would be great.
thanks
|
|
|
|
|
hi i hve requirements in UK on VC++ with MFC/COM in telecome and embeded systems with 2.5 years exp. and also on GSM. if aou ar ethe on esen dyour cv to naidumg@yahoo.com
Mohan
|
|
|
|
|
Sorry guys I'm pretty new to ATL and COM stuff. The project is a shell extension with MFC support. Been looking at the tutorials on it over and over but can't find out how to fix this problem. After starting a new project I can get it to work. Then after compiling a few times (changing nothing) it ends up giving this link error. It starts happening randomly but never goes away once I first get it.
Linking...
mfcs42.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)
mfcs42.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj); second definition ignored
Creating library ReleaseMinSize/program.lib and object ReleaseMinSize/program.exp
ReleaseMinSize/program.dll : fatal error LNK1169: one or more multiply defined symbols found
I can start a new project, transplant the code, and have it working for a while till I get this again. I've had to include afxcmn.h, and change my .cpp files to automatic use of precompiled headers. But apart from that I've not really changed anything. I can get the code to work fine in a nonMFC dll (without using MFC components). Removing all MFC statements I've added doesn't help either.
Any idea on how to fix this?
Thanks
-Neil
|
|
|
|
|
Got the similar problem with MSVCRT.lib myself except my project does not link at all ;(
I hope this one helps you:
Look at your Project Settings -> "C/C++" tab -> "category" combo -> drop "category" combo to "Preprocessor" ->
-> look at "Preprocessor definitions:" edit box. If you find _ATL_MIN_CRT, remove it for all project configurations except "Debug".
This flag tells compiler not to link your project with any Microsoft Standard Runtime Libs (for minimum size).
If you include "MFC support", MFC requires those runtimes linked to your project - that's where collision occurs.
Since you don't have any problems while MFC's presence is disabled, that sounds like my case.
Kirill.
|
|
|
|
|
Thanks for the reply.
I haven't got _ATL_MIN_CRT in my preprocessor definitions it seems. This is what I have:
WIN32,NDEBUG,_WINDOWS,_WINDLL,_AFXDLL,_MBCS,_USRDLL,_ATL_DLL
Removing _ATL_DLL doesn't seem to help. Removing _AFXDLL creates more errors ofcourse.
The strange thing is I can link the project after creating a new one, and notice no differences in any project settings after it starts having this link error.
I've tried deleting some different generated files but that hasn't helped so far either.
Any ideas?
Thanks
|
|
|
|
|
Sorry guys, fixed it now. I was using memset and including memory.h in one of my classes which seemed to cause it. Although I could comment out the memset and include statements, build it, uncomment them and build again and then it'd work. Although gives a warning:
LINK : warning LNK4089: all references to "MSVCIRT.dll" discarded by /OPT:REF
Which is good I guess. Can't see any options or flags that may have changed to cause this though.
|
|
|
|
|
Hello,
I am new to COM/ATL programming and have a question.
If I want to inherit one interface from another I have previously written (e.g. IB : IA ) do I need to implement all of IA's methods in IB? if so is there any way I can use some technique that allows you to just directly call the IA method instead of having to re-write (as in C++).
Thanks.
Paul.
|
|
|
|
|
|
I have had a look at aggregation - could I override methods from my base interface using this?
e.g. where IB : IA
IA* pIA = null
pIB->QueryInterface(IID_IA, &pIA)
1) pIA->methodA()
2) pIB->methodA()
would 1) call the same thing as 2) -- I think it would if these were C++ classes (using cast instead of QI).
help!
|
|
|
|
|
Sure.
1) and 2) will call same function implementation.
I don't quite catch your intention.
This is just simple class or struct inhertance.
This is nothing to do with COM as I understand.
What do you want to do?
Regards,
Ryan
|
|
|
|
|
Hi,
Can anybody tell me how to find out if a COM DLL has implemented a specific interface. All I know is the name of the DLL and the CLSID of the interface. I gues Microsfot is doing something similar when they implements add-ins to both Developer Studio and office?
Martin Eskildsen
|
|
|
|
|
|
Ok - I also thought about QueryInterface in the first place, both I can't figure out how to use it on a spefic DLL (only given the filename of a COM DLL to query the specific DLL wheter it supports the requested interface since).
A short example might make my question more clear:
I have an executable (MyProg.exe) and two COM DLL's (MyDllA.dll and MyDllB.dll). Both Dll's is allowed to support the requested interface (like add-ins in Developer Studio). In this sample both DLL's supports the interface called IMyInterface, with CLSID CLSID_MyInterface.
How can I use QueryInterface in combination with the information above to verify that both DLL's support the interface IMyInterface?
Martin Eskildsen
|
|
|
|
|
You're confusing DLLs vs. COM servers, and CLSIDs vs. IIDs.
First, when creating a COM object, you reference the server by its CLSID, not its filename. CoCreateInstance() takes the CLSID.
You also can request an interface in CoCreateInstance(). So if you have the CLSID of one of the servers, and the IID they support (say IID_IMyInterface) you pass both of those to CoCreateInstance() and check the return value to see if it succeeded.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
In the event that the CLSID of the CoClass object is not known, you can:
- use the COM category manager (ICatInformation) and enumerate the objects' CLSIDs at runtime
- do category management under your own registry key(s), basically you store the list of COM object CLSIDs and you call CoCreateInstance() on those CLSID and get your interface using QueryInterface() after that
|
|
|
|
|
Here we have a Custom OLEDB provider. We have problems
dealing with the null values. The OLEDB provider is in
VC. Here we get the records as an variant array and
then moving it to a stream object and then assigning
it to a BSTR pointer. We are reading that as an ADO
recordset from VB. All the values are ok in VB. But
when we come across null values, we are not able to
process it properly. When we write NULL to the stream
object (which is bytes), we are reading it as 0 in the
VB recordset.(since in vc NULL has a value 0). So i need to read that value as null in
the VB.
In VC i tried writing VT_NULL and VT_EMPTY. But i
could not read that as null in VB.
if i use the isnull(fieldname) , i need to get the
result as true if the value is null. I dont know how
the null value is treated internally.
We use this OLEDB provider not only from VB, we use
even from Crystal reports for reports.
So can anybody please let me know how do it or let me
know any source where i can get the help from.
|
|
|
|
|
Hi,
I have Q concerning ADO/OLEDB.
I am writing an application which has to access MS-Access databases selected
at runtime by the user thru a file open dialog, the format of the data bases
is same but the databases may be located in different places.
1. Can I use ADO/OLEDB to open these DB's when a path is specified
( This capability like that of DAO, the path can be spec and
opened )
2. Or do i need the DSN and not specify the actual location
so that the DSN will ask the user to locate the DB.
(Actually here the application will use ODBC again when i want to
use ADO)
Since you are already working in OLEDB I hope you can help me in
this context.
Any suggestions or awnsers will be helpful.
|
|
|
|
|
Do you set the DBSTATUS_S_ISNULL in the status field for the accessor in your custom OLEDB provider??? I guess that is why VB does not cosider it as NULL properly.
|
|
|
|
|
Hi,
I'm new to COM and ATL and was wondering why do I need another set of windowing classes for COM development since i can easily embed MFC code (tried only for dialogs so far though, maybe i cannot do everything?)
Thanks
|
|
|
|
|
Hello everyone.
This is my first ATL/COM project, and I think the progress is "behaving" so far (happy to be one week behind the deadline). However, there is one dead-end issue that I cannot resolve:
Within my ATL component, I have to use a couple of in-proc Visual Basic - based COM .dll's. I use #import "XXXX.dll" in my source code, but compiler spits out the error "fatal error C1084: Cannot read type library file: 'XXXX.dll': Element not found."
Note that regsvr32 has successfully registered that .dll and .dll's path is correct.
Another spooky observation: OLE View fails to open .dll's IDL file giving me "Could not decompile selected item. Element not found" error message.
If anyone can help, please save me from this miseary.
BIG thanks in advance.
Kirill Sherman
shermank@glstrat.com
|
|
|
|
|
it sounds like you have not compiled your typelibrary into your application. What you need to do is in your .rc file create a custom resource called "TYPELIB" and point it to your .tlb file. This will inclued the tlb in your final compiled DLL so that it can be imported. Your other alternative is to import the actual tlb file instead of the DLL. Hope this helps.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|