Please export function-like macros as functions

Open
#122 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, julia

Research direction

Start with the sam_itr_queryi and sam_itr_destroy definitions linked in htslib/sam.h, then inspect how these APIs appear in the shared library. Identify the function-like macros in the requested API area and verify that the completed change exposes equivalent callable functions for Julia and other wrappers without changing their behavior.

Written by the indexing model from the issue text.

Description

D2: Moderate P3: Low priority

When I tried to write a wrapper of htslib, I found some APIs are not exported as functions and cannot be found in the shared library file. For example, the sam_itr_queryi function is exported as function thus other program can directly call that function via the shared library, but the sam_itr_destroy is actually a function-like macro, whose name is not visible from the outside. Unfortunately, my favorite language (the Julia language) cannot read this kind of macros automatically.

I think that inlining these functions can satisfy my need without imposing performance damage and provide more type-safety. I'd appreciate it if you would replace function-like macros with genuine functions.

Thanks.

Dominant language
C
Stars
950
Forks
475
Avg merge
3d 13h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/htslib

All issues in samtools/htslib

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.