[great-users] RE: [gme-users] querying crosslinks from user library code

Attila Vizhanyo viza at isis.vanderbilt.edu
Fri Oct 14 12:15:24 CDT 2005


Matt,

Please, see my answers inline.

Matthew J. Emerson wrote:

> Thanks Attila, let me just be clear on how exactly I get this work.
>
> Clearly I won’t be able to build a static library to link in with 
> GRE-created DLL, so I should set up my UserCodeLibrary specification 
> like this:
>
[Attila:]
Why not? Your user code library should contain your user code 
(SoftwarePartitioning.h,.cpp) and all the DS-API.h header files only.
GRE will link this library with the DS-API library (DS-API.h,.cpp files) 
and the Udm core libraries. This should work.

> Not like this:
>
> And inside C:\GReATLibs I should have the header and source files of 
> my library?
>
[Attila:]
Where do you keep your .cpp files is irrelevant from GReAT's point of view.

> Then, inside my library header file (in this case 
> SoftwarePartitioning.h) I still need to include the DS API header 
> files (which are generated into the $ProjectName$/udm directory).
>
[Attila:]
That is correct.

> What if I’m using the code generator and not the GRE to build my 
> transformation? Does the same thing apply?
>
[Attila:]
Yes. You can go two ways with the CG. (1) is to link the generated 
transformation source files with DS-API.lib files. In this case when 
your user code library is linked, the linker will find the Udm meta 
class definition in DS-API.lib
(2) is to compile the DS-API files in source file format with the 
generated transformation source files. In this case when your user code 
library is linked, the linker will find the Udm meta class definition in 
the compiled DS-API object files.

You can control this option via the "Meta code generation mode for Code 
Gen" attribute of your config model.

> After awhile, all of the changes needed to use external code in a 
> GReAT transformation get sort of complex – I have to change my header 
> files, UserCodeLibrary attributes, and the location of the different 
> files involved depending on whether I’m using the CG or the GRE, and 
> now there are special rules for using the DS API with external code. 
> Some documentation or examples that use external libraries in several 
> different configurations (DS API or no, CG or GRE) should be included 
> with the next release.
>
[Attila:]
You are right in saying that there are special rules exist in charge of 
how to write a user code library, but in general, that is the case for 
every framework you want to customize: you need to follow the rules 
defined by the framework. But the use of user code libraries do not 
depend on these criteria you described above (CG or GRE, DS API or no). 
If you want to use DS API in a user code library, you need to include 
header files in order to have you code compile, but you *must be aware 
of* that the DS-API is already included in the transformation runtime, 
and therefore it is not neccessary to include it in your library.

Please report any problems you encounter with user code libraries either 
on this list or JIRA.

Thanks,
Attila

> --Matt
>
> ------------------------------------------------------------------------
>
> *From:* great-users-bounces at list.isis.vanderbilt.edu 
> [mailto:great-users-bounces at list.isis.vanderbilt.edu] *On Behalf Of 
> *Attila Vizhanyo
> *Sent:* Friday, October 14, 2005 9:21 AM
> *To:* great-users
> *Subject:* [great-users] RE: [gme-users] querying crosslinks from user 
> library code
>
> If you include the domain specific API files in a C++ project, then 
> Udm will create and manage some global static variables to represent 
> the corresponding meta information.
>
> These variables are needed to use the DS-API, and there most be a 
> singleton instance of each meta class within the process.
>
> When you specify a user code library in a GReAT transformation, that 
> library is linked into a DLL, that the GReAT engine will load 
> dynamically during runtime.
>
> The dll already contains the DS API files, so your user code library 
> typically should not include the DS .cpp files, because if it does, 
> then two separate instances of each meta class will coexist within the 
> same process.
>
> This way your library will not be self-contained, because it is 
> missing some class definitions, but the linker will resolve the meta 
> class object references when linking the DLL.
>
> HTH,
>
> Attila
>
> -----Original Message-----
> *From:* gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] *On Behalf Of 
> *Aditya Agrawal
> *Sent:* Friday, October 14, 2005 8:09 AM
> *To:* gme-users
> *Subject:* RE: [gme-users] querying crosslinks from user library code
>
> Hi Mat,
>
> I have queried and established cross links through Attribute Mapping 
> code in the past. When I did do it I used UDM’s generic API because we 
> didn’t support the specific API then.
>
> It seems that you are calling external code in Attribute Mapping, if 
> that’s the case then you will need to have all three paradigm’s, 
> start, cross, end’s .h file included in the custom code for it to work.
>
> I hope this is the right direction.
>
> Thanks,
> Adi
>
> ------------------------------------------------------------------------
>
> *From:* gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] *On Behalf Of 
> *Matthew J. Emerson
> *Sent:* Thursday, October 13, 2005 6:20 PM
> *To:* gme-users
> *Subject:* [gme-users] querying crosslinks from user library code
>
> Is it supposed to be legal to query crosslink connections set up in a 
> GReAT transformation from user library code? I’ve been testing this 
> out, and it doesn’t seem to work.
>
> In a rule, I can successfully match a pattern involving a crosslink 
> connection from a source object to a destination object. Then, I pass 
> the source object in as the parameter to a function implemented in my 
> library using an AttributeMapping block. Inside the library function, 
> I try and find the same destination object using the same crosslink 
> connection. This never returns the object, even though obviously I had 
> to have successfully matched it in the rule for library function to 
> even get called. Is this something that’s supposed to work?
>
> --Matt
>
>------------------------------------------------------------------------
>
>_______________________________________________
>great-users mailing list
>great-users at list.isis.vanderbilt.edu
>http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
>  
>


More information about the great-users mailing list