CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2005
    Posts
    3

    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?

  2. #2
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: memcp -> Linker Error when used in .DLL

    did u add include <math.h> ?
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  3. #3
    Join Date
    Oct 2005
    Posts
    3

    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++);
    }
    }

  4. #4
    Join Date
    May 2005
    Posts
    4,954

    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
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  5. #5
    Join Date
    Jan 2004
    Posts
    206

    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.

  6. #6
    Join Date
    Oct 2005
    Posts
    3

    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.
    Attached Images Attached Images  

  7. #7
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Lightbulb 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.
    Last edited by humptydumpty; October 18th, 2005 at 02:51 AM.

  8. #8
    Join Date
    Aug 2004
    Location
    Bucuresti
    Posts
    38

    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.
    Regards,
    Cosmin

  9. #9
    Join Date
    Jun 2013
    Posts
    1

    Re: memcp -> Linker Error when used in .DLL

    Quote Originally Posted by Wursti View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured