Why is GenTLB renaming symbols (appending '_') - delphi

I am using GenTLB.exe to compile a ridl file to .tlb and _TLB.pas files.
In the resulting _TLB.pas file, there are hints that it has renamed a number of symbols by appending an underscore to the end of the name.
A sample of the hints is:
// Errors:
// Hint: Symbol 'Assign' renamed to 'Assign_'
// Hint: Enum Member '_amStretch' of 'EnumVRSAppliedMaterial' changed to '_amStretch_'
// Hint: Enum Member '_amTile' of 'EnumVRSAppliedMaterial' changed to '_amTile_'
The command line I use with GenTLB is:
GenTLB -P -Pt+ <ridl file>
I get the same problem occuring if I use the tlibimp tool as well.

I am not sure, but often an underscore is appended in front of a name, if the name is conflicting with and exsisting name (e.g. reserwed word, and so).
It could be something like that.

Assign is renamed to Assign_ because of a mapping in tlibimp.sym, a INI-format text file in the same directory as tlibimp.
Another piece of logic continuously appends '_' until the name is unique with respect to prior global names tlibimp has found. All enumeration members are interpreted as globals. Are there any other instances of _amTile etc. in the generated .pas file?

Related

Differences between anonymous and non-anonymous hyperlinks in Sphinx

In one of my Sphinx files, I have this :
.. _pyjnius:
Pyjnius
=======
When running on Android, a version of the `Pyjnius <https://pyjnius.readthedocs.io/en/stable/>`_
library is available. This allows advanced creators to call into the Android
libraries.
It seems to compile just how I want it to, but I get a warning saying that WARNING: Duplicate explicit target name: "pyjnius". I got to this issue, advising to end the link with two underscores rather than one, and that it's called an anonymous link. It's not the exact same problem: in the issue there's two links with the same name, and in my case there's only one link, but I tried the solution and it works.
What are the differences between `this <link>`_ and `that <link>`__, aka between anonymous and non-anonymous links ? What would happen if I convert all my external hyperlinks to the double-underscore syntax ?
What are the differences between (...) between anonymous and non-anonymous link
A reference name is created when you declare a hyperlink target. But if the target is anonymous the name isn't used to match the reference to its target. The following quote from the docs sums it up:
Anonymous Hyperlinks
The reference name of the reference is not used to match the reference to its target. Instead, the order of anonymous hyperlink references and targets within the document is significant: the first anonymous reference will link to the first anonymous target. The number of anonymous hyperlink references in a document must match the number of anonymous targets.
Now the second part of the question that was embedded in the same sentence:
What are the differences between `this <link>`_ and `that <link>`__
If you read the reStructuredText specification carefully, no clear example of the concise `Title <Link>`_ syntax is given, but it's an external hyperlink target (because the URL points to the exterior of your documentation). What happens is that the Title acts as the reference name for the target, hence the verbatim error: "Duplicate explicit target name".
Making the declaration of the hyperlink target anonymous by using the double underscore __ causes Title not to be used as the target name, thus there's no longer a duplicate target name because order of declaration is used to match the anonymous target to the link.
In conclusion:
and in my case there's only one link
Yes, but what the error message is saying is that there's a "Duplicate explicit target name" the problem is that Pyjnius is declared as a target once above the section, and again explicitly as the title (acting as target name) in the link using the shortened syntax.
Also note that the reference names (the target, or title) is normalized and thus case insensitive. Thus in your example the name Pyjnius <URL> ends up being normalized to pyjnius which is the same target name above the section.
Reference Names
case is normalized (all alphabetic characters are converted to lowercase).

How can I create a link to a random text in the same document? [duplicate]

I'm using :class: and getting a lot of warnings
WARNING: py:class reference target not found: mypkg.submodule.class.
I can't find anywhere in the documentation what exactly the requirements are for a correct cross-reference.
This is currently an incomplete list of requirements I think there are:
The module of the object needs to be importable
The object needs to exist inside of the module
The object needs to be documented somewhere else in the build with a :py:class::, :py:func:: or similar directive
This directive can be generated by the autodoc extension, in which case the object needs to have a docstring associated to it.
For something to be cross-referenced it has to first be "declared".
The Python domain (name py) provides the following directives for module declarations:
There are 2 cases to consider:
domain directives (.. domain:directive_name::) and
roles (:domain:role_name:).
The case of :class: you specify is actually the shortened syntax of writing the role :py:class: not to be confused with the directive declaration .. py:class::.
This directive can be generated by the autodoc extension, in which case the object needs to have a docstring associated to it.
The directive declarations are done implicitly by autodoc, but for objects without docstrings to be declared by autodoc you must use :undoc-members: option with the autodoc directives.
Members without docstrings will be left out, unless you give the undoc-members flag option:
.. automodule:: noodle
:members:
:undoc-members:
One effect of declaring an object is that it is inserted in the index. So you can check the index to make sure it has been declared and inserted. (However note that labels used in referencing arbitrary locations are not inserted in the index.)

Bazel workaround for filenames with ':' in them?

I have Python tests that depend on files with ':' in the filenames.
I would like to put the tests under bazel, but bazel becomes unhappy when I supply the files in the data argument to py_test, complaining that:
invalid target name 'bazel_test_cases/foo/input/foo:bar': target names may not contain ':'
Is there a work around for this?
I don't think there is a workaround. : is normally used to separate the package and the target name. And trying to escape with \ fails with target names may not contain '\'

How to read a string in .pc file

I am writing a program to connect the database in c++ in a file with .pcg extension. I am trying to input name (with spaces between first name and last name). I have defined the variable as char name[40]. But name variable stores only the first name and the rejects the part after the space. How to get the whole name in the name variable? I have tried "string name". I'm using g++ compiler and it's giving error.

How do I produce a .SRM file containing string resources?

The example I am looking at is in the TurboPower FlashFiler database.
It has, for example, a file ffclcnst.rc which contains
FF_CLIENT_STRINGS RCDATA FFCLCNST.SRM
and I can run
BRCC32 ffclcnst.rc
at the command prompt which seems to compile the .SRM file into a .RES file, but I cannot see how to change the information in the .SRM file. It appears to come from the ffclcnst.str file so I assume there is some way to convert the .STR file into the .SRM file.
The readme tells you:
Most of FlashFiler's error messages are stored in string resource
files having the extension STR. If you change these files, you must
recompile them using the TurboPower String Resource Manager located at
http://sourceforge.net/projects/tpsrmgr
Please note that these are not standard Windows string resources. They're something TurboPower made up. For a full explanation, be sure to read the String Resource Manager's documentation. You can make an ordinary string-table resource in your .rc file, or you can skip the .rc file altogether and declare resourcestring constants directly in your Delphi code. Unless you're editing TurboPower code, or you need to support ancient Delphi versions, I recommend you just use normal string tables.

Resources