-
March 7th, 2025, 12:16 PM
#1
[RESOLVED] DLL using GetProcAddress no exporting performed in DLL
HI,
I am creating a very simple DLL, and I have the LoadLibrary problem temporarily fixed, I now face an issue where GetProcAddress does not find any exported functions. Not sure what the DLL defines may be missing but any input would be greatly appreciated. This is for a very simple/crude timer using Sleep as the timer. Need it for a System Dialog that pops up when obj.click is called in HTML and prevents the program from continuing automation. Looking to use this DLL as a way to press the OK button on the DLG box and move on without human interaction. Below is the DLL code, so if you point out why the functions are not being exported would be greatly appreciated. I do get a 127 error "Procedure not defined", so it is most definatly the DLL.
Code:
#define EPIQUTIL_EXPORTS;
#ifdef EPIQUTIL_EXPORTS
#define EPIQUTIL_API __declspec(dllexport)
#else
#define EPIQUTIL_API __declspec(dllimport)
#endif
// The functions needed to interface with VBA EPIQ Utils
// This function must be called before any other function.
extern "C" EPIQUTIL_API void EPIQ_init(const long MyWaitTime);
Suggestions?
UPDATE: Found out that none of the functions are being exported, that would explain GetProcAddress failing. Used DependenciesGui to discover this. So now the question is how do I get them to export? I thought that with __declspec(dllexport) that VC would take care of exporting the functions. Any suggestions to this issue would be greatly appreciated.
UPDATE2: I had MVS generate a DLL with exports and even their own creation does not export a single thing. Help!!
Last edited by funkmonkey; March 7th, 2025 at 09:25 PM.
-
March 8th, 2025, 04:49 AM
#2
Re: DLL using GetProcAddress no exporting performed in DLL
For info, these are test codes for generating a .dll
mydll.h
Code:
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef NUM_EXPORT
#define NUM_API extern "C" __declspec(dllexport)
#else
#define NUM_API extern "C" __declspec(dllimport)
#endif
NUM_API int intdouble(int i);
dllmain.cpp
Code:
#define NUM_EXPORT
#include "mydll.h"
int intdouble(int i) {
return i + i;
}
when compiled with VS generates a mydll.dll which exports intdouble.
Code:
dumpbin /exports mydll.dll
Microsoft (R) COFF/PE Dumper Version 7.10.6030
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file mydll.dll
File Type: DLL
Section contains the following exports for mydll.dll
00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00001010 intdouble
Summary
1000 .data
1000 .pdata
1F000 .rdata
1000 .reloc
1000 .rsrc
2000 .text
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
March 8th, 2025, 03:12 PM
#3
Re: DLL using GetProcAddress no exporting performed in DLL
 Originally Posted by 2kaud
For info, these are test codes for generating a .dll
mydll.h
Code:
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef NUM_EXPORT
#define NUM_API extern "C" __declspec(dllexport)
#else
#define NUM_API extern "C" __declspec(dllimport)
#endif
NUM_API int intdouble(int i);
dllmain.cpp
Code:
#define NUM_EXPORT
#include "mydll.h"
int intdouble(int i) {
return i + i;
}
when compiled with VS generates a mydll.dll which exports intdouble.
Code:
dumpbin /exports mydll.dll
Microsoft (R) COFF/PE Dumper Version 7.10.6030
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file mydll.dll
File Type: DLL
Section contains the following exports for mydll.dll
00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00001010 intdouble
Summary
1000 .data
1000 .pdata
1F000 .rdata
1000 .reloc
1000 .rsrc
2000 .text
Thanks. I"m not seeing much difference in yours and my code. Not sure why I'm not generating exports. I will modify my define macro to be like yours and see what happens. Could there be a setup in the linker that is causing this situation?
-
March 8th, 2025, 05:26 PM
#4
Re: DLL using GetProcAddress no exporting performed in DLL
 Originally Posted by funkmonkey
Thanks. I"m not seeing much difference in yours and my code. Not sure why I'm not generating exports. I will modify my define macro to be like yours and see what happens. Could there be a setup in the linker that is causing this situation?
RESOLVED: It appears that it has to be compiled under 32bit. Works now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|