{"id":30583322,"url":"https://github.com/synergex/sampledll","last_synced_at":"2026-06-15T21:31:27.557Z","repository":{"id":149574597,"uuid":"439070263","full_name":"Synergex/SampleDLL","owner":"Synergex","description":"This code sample demonstrates three different use cases for returning values from a DLL routine: 1. Returning a simple integer value 2. Returning a pointer to a data structure 3. Returning a pointer to a pointer to a data structure","archived":false,"fork":false,"pushed_at":"2022-07-25T20:12:12.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-09T12:02:27.412Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Synergex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-12-16T17:16:01.000Z","updated_at":"2022-08-04T16:50:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"7ec6b1df-cb8a-47a3-949e-c0e72926bfd6","html_url":"https://github.com/Synergex/SampleDLL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Synergex/SampleDLL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSampleDLL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSampleDLL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSampleDLL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSampleDLL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Synergex","download_url":"https://codeload.github.com/Synergex/SampleDLL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synergex%2FSampleDLL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34381758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-29T08:33:37.222Z","updated_at":"2026-06-15T21:31:27.551Z","avatar_url":"https://github.com/Synergex.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SampleDLL\u003cbr /\u003e\n**Created Date:** 11/17/2009\u003cbr /\u003e\n**Last Updated:** 11/17/2009\u003cbr /\u003e\n**Description:** This code sample demonstrates three different use cases for returning values from a DLL routine: 1. Returning a simple integer value 2. Returning a pointer to a data structure 3. Returning a pointer to a pointer to a data structure\u003cbr /\u003e\n**Platforms:** Windows\u003cbr /\u003e\n**Products:** Synergy DBL; DLL API\u003cbr /\u003e\n**Minimum Version:** 9.1.5\u003cbr /\u003e\n**Author:** Chip Camden\n\u003chr\u003e\n\n**Additional Information:**\nFile included:\n\nsample.dbl Example Synergy/DE program that calls the DLL routines\nand processes the returned values.\nSampleDLL.sln A Microsoft Visual Studio solution for building the DLL\nSampleDLL/*.* Source files for the DLL (see especially SampleDll.(cpp,h))\nRelease/SampleDLL.dll A 32-bit version of the DLL\nx64/Release/SampleDLL.dll A 64-bit version of the DLL\n\nNOTES ON SPECIFIC FUNCTIONS\n\nfnSampleDLL\n\nThis function merely returns an integer value.\n\nfnSampleDLLptr\n\nThis function returns a pointer to a data structure SAMPLESTRUCT\nthat is defined in SampleDLL.h and duplicated as sampleStruct in\nsample.dll. Note that the C++ routine returns the address of\none of these structures, which MUST BE PERSISTENT. In this case,\nwe use a static. If the structure were an auto variable, then it\nwould be released upon return from this routine, which could cause\nunpredictable failures.\n\nIn the Synergy/DE code, the pointer is dereferenced by registering\na memory handle to the address, and mapping it to the structure\nthat we have defined to match the structure from the DLL.\n\nfnSampleDLLptrptr\n\nThis function returns a pointer to a pointer to the same data\nstructure. In this case, we must first dereference the returned\npointer to obtain a pointer to the structure. The same rules\napply with regard to the persistence of the items referenced --\nin this case, both the structure and the pointer to it must\npersist beyond the return from the routine, so statics are used\nfor both.\n\nOn the Synergy/DE side, we register a handle to the returned address,\nthen treat that handle as referencing an integer value of the size\nD_ADDRSIZE (the size of a pointer). This will work for both 32-bit\nand 64-bit platforms, because we use D_ADDRSIZE. Then we can take\nthat value and treat it as a pointer, the same as if it had been\nreturned by fnSampleDLLptr.\n\nThe same principle can be applied to pointers that are returned as\nmembers of a data structure, or a pointer to an array of pointers.\nIn the latter case, simply increment the pointer to the array by\nD_ADDRSIZE to access the next pointer in the array.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergex%2Fsampledll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynergex%2Fsampledll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergex%2Fsampledll/lists"}