memcp -> Linker Error when used in .DLL
Hi,
I am using Borland C++ Builder6 to create a .dll. The programm works fine but I can't use memcpy() from math.h or string.h as I get a Linker Error (Unresolved external 'memcpy' referenced)
when using it.
Does anybody have an idea of how to solve this issue?
Re: memcp -> Linker Error when used in .DLL
did u add include <math.h> ?
Re: memcp -> Linker Error when used in .DLL
Yes, I tried all mem.h, math.h and string.h.
As soon as I use the method I get a Linker Error.
When I create a stand alone .exe it works fine but if I want to use the same source within a .dll -> Error. :-(
Meanwhile I use my own implementation, but I am not sure if it works so faultless as the mem.h version.
memcpy(void *dest, const void *src, size_t n){
for(int i = 0; i < n; i++){
*(dest++) = *(src++);
}
}
Re: memcp -> Linker Error when used in .DLL
Quote:
Originally Posted by Wursti
Yes, I tried all mem.h, math.h and string.h.
As soon as I use the method I get a Linker Error.
When I create a stand alone .exe it works fine but if I want to use the same source within a .dll -> Error. :-(
well i dont know whats the problem exactly...can you attach your project here?
so we can take a look?
another thing instead of using your owm implementation you can try using the ::CopyMemory(..) api.
Cheers
Re: memcp -> Linker Error when used in .DLL
Check your linker settings. Unresolved external symbol happens when the linker is unable to find the implementation of certain functions inside any of the library files that it is linking. It has nothing to do with inclusion of header files.
1 Attachment(s)
Re: memcp -> Linker Error when used in .DLL
@golanshahar
I get the same error when using CopyMemory as when using memcpy.
Unfortunatly the project is to huge to poste the entire source so I just made a screen shot of the current implementation and the error I get.
@Wombat
I tryed all the linker settings. the settings work when creating a .exe. the error only occurs when creating a .dll.
I had the same error with some of my own methods in referenced files but I was able to fix them by putting a "__declspec(dllexport) __stdcall " infront of those methods.
But with memcpy I can't solve it that way.
Re: memcp -> Linker Error when used in .DLL
Quote:
Originally Posted by Wursti
Hi,
I am using Borland C++ Builder6 to create a .dll. The programm works fine but I can't use memcpy() from math.h or string.h as I get a Linker Error (Unresolved external 'memcpy' referenced)
when using it.
Does anybody have an idea of how to solve this issue?
First math.h doesn't contain dec about memcpy() function
For this u have to use
<memory.h> or <string.h>
can u Show How and where u r including this files and what's the link error u r getting.
Re: memcp -> Linker Error when used in .DLL
Maybe the Borland C++ Builder is (auto)linking some default libraries only for ".exe" projects; you can check the settings and add all the linker options used for the .exe also to your dll.
Re: memcp -> Linker Error when used in .DLL
Quote:
Originally Posted by
Wursti
Hi,
I am using Borland C++ Builder6 to create a .dll. The programm works fine but I can't use memcpy() from math.h or string.h as I get a Linker Error (Unresolved external 'memcpy' referenced)
when using it.
Does anybody have an idea of how to solve this issue?
Check "Project->Options->Advanced Compiler->Output(Generate underscores)" - must be have.
Me help with memcpy() in .dll on Borland C++ Builder 6 sp4