Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bug in ITypeLib 64 bit + Discussion on style of declarations

Aperta
#11 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
visualbasic

Direzione di ricerca

Esamina Export/Sources/slTypelib.twin alle righe indicate 30 e 33, quindi confronta la dichiarazione di ITypeLib con la firma della Windows COM API, in particolare il tipo restituito PVOID. Conferma l’impatto sulla compatibilità di qualsiasi modifica allo stile dei parametri e documenta o implementa una soluzione concordata per le questioni relative alla dichiarazione e alla denominazione dell’API.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

https://github.com/fafalone/tbShellLib/blob/93346dece996ba12da8526ad21a923bdb95cc00f/Export/Sources/slTypelib.twin#L33

This should return LongPtr I believe (it is PVOID)


Also I wonder how you would feel about 2 (or 3) improvements to make this more idiomatic:

https://github.com/fafalone/tbShellLib/blob/93346dece996ba12da8526ad21a923bdb95cc00f/Export/Sources/slTypelib.twin#L30

In my code, I have declared this as

Sub GetDocumentation(ByVal memid As MEMID, Optional ByRef pBstrName As String, Optional ByRef pBstrDocString As String = vbNullString, Optional ByRef pdwHelpContext As Long, Optional ByRef pBstrHelpFile As String)

with 2 changes: The Optional arguments, since these are optional from the API point of view. You can specify default of =vbNullString and =NULL_PTR or =0 if needed

Second change is I do

Public Enum MEMID
	[_]
End Enum

This does a sort of typedef for DWORD types which improves readability IMO

3rd change is I rename parameters to for example

Sub GetDocumentation(ByVal memid As MEMID, Optional ByRef outName As String, ...)

Since ByRef pBstrName to me is

  • Too much information; I don't need to know about Bstr as a VBA developer, just String
  • ByRef and p both mean kinda the same thing, doubling up makes me expect to get a pointer to a string out, not just a string
  • I think the outParam prefix is good from a VBA consumer point of view to make it clear. Attributes may be better in future tB.

I think this may be a harder sell as it is backwards incompatible for your library interface. However in my experience when I declare the APIs this way it makes me much less likely to need to look at the MSDN documentation. But it's still easy to look up online even if I've renamed the params, the function name is the same and the order of params is the same. Maybe for version 3.x of your package.

Lingua principale
Visual Basic 6.0
Stelle
51
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fafalone/WinDevLib

Tutte le issue di fafalone/WinDevLib

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.