Title: Didn't work with virtual functions · Issue #118 · fancycode/MemoryModule · GitHub
Open Graph Title: Didn't work with virtual functions · Issue #118 · fancycode/MemoryModule
X Title: Didn't work with virtual functions · Issue #118 · fancycode/MemoryModule
Description: I'm using the latest version 5f83e41 and VS2022. to reproduce this issue,please add a file ISampleDLL.h in SampleDLL dir: #pragma once class ISampleDLL { public: virtual ~ISampleDLL() = default; virtual int addNumbers(int a,int b) = 0; }...
Open Graph Description: I'm using the latest version 5f83e41 and VS2022. to reproduce this issue,please add a file ISampleDLL.h in SampleDLL dir: #pragma once class ISampleDLL { public: virtual ~ISampleDLL() = default; vi...
X Description: I'm using the latest version 5f83e41 and VS2022. to reproduce this issue,please add a file ISampleDLL.h in SampleDLL dir: #pragma once class ISampleDLL { public: virtual ~ISampleDLL() = default...
Opengraph URL: https://github.com/fancycode/MemoryModule/issues/118
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Didn't work with virtual functions","articleBody":"I'm using the latest version [5f83e41](https://github.com/fancycode/MemoryModule/commit/5f83e41c3a3e7c6e8284a5c1afa5a38790809461)\nand VS2022.\nto reproduce this issue,please add a file ``ISampleDLL.h`` in SampleDLL dir:\n```\n#pragma once\n\nclass ISampleDLL\n{\npublic:\n\tvirtual ~ISampleDLL() = default;\n\tvirtual int addNumbers(int a,int b) = 0;\n};\n```\nand replace ``SampleDLL.h``\n```\n#include \"ISampleDLL.h\"\nclass SampleDLL: public ISampleDLL\n{\npublic:\n\tstatic SampleDLL\u0026 Instance();\n\t\n\tvirtual int addNumbers(int a,int b) override;\nprivate:\n\tSampleDLL();\n\t~SampleDLL();\n\tSampleDLL(const SampleDLL\u0026) = delete;\n\tSampleDLL\u0026 operator=(const SampleDLL\u0026) = delete;\n};\n```\n``SampleDLL.cpp``\n```\n#include \"SampleDLL.h\"\n\nSampleDLL::SampleDLL()\n{}\n\nSampleDLL::~SampleDLL()\n{}\n\nSampleDLL\u0026 SampleDLL::Instance()\n{\n\tstatic SampleDLL instance;\n\treturn instance;\n}\n\nint SampleDLL::addNumbers(int a,int b)\n{\n\treturn a + b;\n}\n\nextern \"C\" __declspec(dllexport) ISampleDLL* CreateSampleDLL()\n{\n\treturn \u0026SampleDLL::Instance();\n}\n```\nedit ``DllLoader.cpp``\n```\n...\n#include \"../SampleDLL/ISampleDLL.h\"\n...\nvoid LoadFromMemory(void)\n{\n...\n using GetSampleDLL=ISampleDLL* (*)();\n //addNumber = (addNumberProc)MemoryGetProcAddress(handle, \"addNumbers\");\n GetSampleDLL getSampleDLL = (GetSampleDLL)MemoryGetProcAddress(handle,\"CreateSampleDLL\");\n ISampleDLL* sampleDLL = getSampleDLL();\n _tprintf(_T(\"From memory: %d\\n\"), sampleDLL-\u003eaddNumbers(1, 2));\n...\n}\n```\nthen variable ``getSampleDLL`` and ``sampleDLL`` have not null address,but the vftable of ``sampleDLL`` got adress 0x0.\n\nps. I have read [issue#31](https://github.com/fancycode/MemoryModule/issues/31) but it didn't solve my problem","author":{"url":"https://github.com/xkcd50","@type":"Person","name":"xkcd50"},"datePublished":"2025-03-15T13:33:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/118/MemoryModule/issues/118"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8d361512-8c88-4a37-ef61-c37f60f45ebc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B730:2ABBC9:3C00C36:5080339:696F1F34 |
| html-safe-nonce | 6f7599115e90739cf2392a8167f2843b2652a950ca795c0bf4db3edda18cd3ba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzMwOjJBQkJDOTozQzAwQzM2OjUwODAzMzk6Njk2RjFGMzQiLCJ2aXNpdG9yX2lkIjoiNzI4NDgwNTA5MTc3ODgzMDEzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0edbdb1c944f934042e15f83f19e765c67c01118bda8823c354dfb7dbb8b54dd |
| hovercard-subject-tag | issue:2922107307 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fancycode/MemoryModule/118/issue_layout |
| twitter:image | https://opengraph.githubassets.com/363a80ff7cf02a2e04ad4c8bd10cef8ee6ce94c77523709870eea7318a129a31/fancycode/MemoryModule/issues/118 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/363a80ff7cf02a2e04ad4c8bd10cef8ee6ce94c77523709870eea7318a129a31/fancycode/MemoryModule/issues/118 |
| og:image:alt | I'm using the latest version 5f83e41 and VS2022. to reproduce this issue,please add a file ISampleDLL.h in SampleDLL dir: #pragma once class ISampleDLL { public: virtual ~ISampleDLL() = default; vi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xkcd50 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/fancycode/MemoryModule git https://github.com/fancycode/MemoryModule.git |
| octolytics-dimension-user_id | 247730 |
| octolytics-dimension-user_login | fancycode |
| octolytics-dimension-repository_id | 1018522 |
| octolytics-dimension-repository_nwo | fancycode/MemoryModule |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1018522 |
| octolytics-dimension-repository_network_root_nwo | fancycode/MemoryModule |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width