Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Currently, I'm trying to add another "C" routine into a DLL file.
I've made the routine inside a DLL source file.
I've declared the routine, and also indicated the intentions as it will be exported.
The function name is also included in a DEF file.
I called the routine from inside the DLL file. And it works.
And the file name spelling is consistent thru-out the solution.

So, In writing program in another file, and calling some exported functions for within the DLL, Of the two I attempt to call,
one works perfectly, while the other produces an error saying "function is undefined - if I uncomment out the fucntion call.
I've checked all thee above stuff, and all checks out OK.

Everytime I compile this program, it always errors out at this particular function call location.

What am I doing wrong?? I'm going nuts.
Are there DLL size limits/capacities that I must adhere to?

I've added functions before, but have not gone thru all this trouble.
So what am I doing wrong??

What I have tried:

a series of hard knocks, and trial and errors.
0x01AA 27-Mar-24 18:16pm    
You need to make sure that your application which consumes the dll is compiled with the current lib/header files of the modified dll
Richard MacCutchan 28-Mar-24 4:49am    
"So what am I doing wrong??"
Without seeing your code we cannot guess.

Firstly, there are no limits to DLL sizes or capacities. Secondly, it is important to note what is emitting that error message. It could be the compiler or the linker. If it is from the compiler then you have not defined a prototype for the function. If it is from the linker then your prototype definition does not agree with how the function is exported from the DLL. This is an important distinction to make.

If you find the message comes from the linker then you need to determine how the function is being exported. You can do this a few different ways but I prefer to open a Visual Studio command prompt and use the dumpbin utility with the /EXPORTS option so you can see the exported name directly. The next step is to adjust things so they are compatible.

Once you determine these things the next steps are fairly straight forward. Please do that and post back here and I can help you further.
Share this answer
Verify that your new dll function has the same export macro signature as the other dll function. Mostly some DLL_EXPORT or similar macro stuff.
Another common issue is that, your new dll isnt used by the calling program but a stale version in some different directory.
A more rare mistake is some different signature in export and implementation like an char* with wchar* mismatch with handled in your dll project correctly but has different settings.

"Welcome in dll hell" :-/
Share this answer
Rick York 28-Mar-24 12:31pm    
That is one of several reasons I avoid using DLLs unless I absolutely have to such as with hooks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900