API Support Forum
OEC API > API Support > GAIN API COM interface bugs
Author Topic: GAIN API COM interface bugs
(5 messages, Page 1 of 1)
Moderators: VPfau
WWatson2582
Posts: 43
Joined: May 03, 2018


Posted: Feb 27, 2020 @ 03:17 PM             Msg. 1 of 5
Good afternoon:

I am having some problems getting the CppCOMSample application to compile using the GAIN API COM interface:

1) In stdafx.h, the type lib id is incorrect. It appears to reference the typelib id of the old OEC API and should replaced with:

#import "libid:20A98AD2-2C0F-4192-A53D-0F6189ED5B2B"

2) The bug I cannot correct here is that in the typelib, the reserved C++ keyword "template" is used as a variable name causing the following warning to be emitted:

>d:\devel\gfapi\cppcomsample\stdafx.h(74): warning C4279: 'template': identifier in type library '20A98AD2-2C0F-4192-A53D-0F6189ED5B2B' is a keyword; use the 'rename' qualifier

and many compilation errors to occur for the file gf.api.com.tlh:

1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11560): error C2143: syntax error : missing ')' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11560): error C2143: syntax error : missing ';' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11560): error C2059: syntax error : ')'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11560): error C2059: syntax error : ';'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11574): error C2143: syntax error : missing ')' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11574): error C2143: syntax error : missing ';' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11574): error C2059: syntax error : ','
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(11575): error C2059: syntax error : ')'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(13029): error C2143: syntax error : missing ')' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(13029): error C2143: syntax error : missing ';' before 'template'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(13029): error C2059: syntax error : ')'
1>d:\devel\gfapi\cppcomsample\debugx64\gf.api.com.tlh(13029): error C2059: syntax error : ';'

Your assistance with this would be greatly appreciated!

Scott Watson
VPfau
Moderator
Posts: 164
Joined:


Posted: Mar 04, 2020 @ 10:17 AM             Msg. 2 of 5
Hello Scott,

One of our developers is working on this topic right now. We will update you as soon as we get any result.
Thank you for you patience.
Vitaliy Pfau
RBduov
Posts: 6
Joined:


Posted: Mar 06, 2020 @ 01:45 AM             Msg. 3 of 5
Scott Watson,
1) In stdafx.h, the type lib id is incorrect. It appears to reference the typelib id of the old OEC API and should replaced with:

You are right, the current GUID for importing GF.API.COM into your own project is "20A98AD2-2C0F-4192-A53D-0F6189ED5B2B".

2) The bug I cannot correct here is that in the typelib, the reserved C++ keyword "template" is used as a variable name causing the following warning to be emitted:

We are aware of this problem and going to roll out the fix soon.

At the moment, I can recommend using the #import directive with the 'rename' attribute.
https://docs.microsoft.com/en-us/cpp/preprocessor/rename-hash-import?view=vs-2019

#import "libid:20A98AD2-2C0F-4192-A53D-0F6189ED5B2B" rename("max","maximum") rename("min","minimum") rename("template","tmplt")// OEC API
#import "libid:BED7F4EA-1A96-11D2-8F08-00A0C9A6186D" rename("ReportEvent","MsReportEvent")// mscorlib


Thanks for your patience.
WWatson2582
Posts: 43
Joined: May 03, 2018


Posted: Mar 09, 2020 @ 10:29 AM             Msg. 4 of 5
Those lines certainly allow me to compile the "stdafx.h" file, but the contents of the "OECAPIEvents.h" file again relate back to the old OEC API COM interface and cannot possibly compile with the GF API.

Has someone neglected to post the GF API compatible version of the CppCOMSample code or has no one ever tried to actually use the GF API COM interface? Please let me know how to proceed.

Thanks!
CMicciche902
Posts: 367
Joined:


Posted: Mar 11, 2020 @ 04:49 PM             Msg. 5 of 5
I have requested a new COM sample be built. Stay tuned.
Chris M