CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2009
    Posts
    1,355

    [RESOLVED] we can add dll's by code?

    we can add dll's by code right(to exe)?

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: we can add dll's by code?

    What do you mean by "add dll's"?
    And in which platform?
    For example, (if what you meant was "execute some function from dll") in Windows you could use LoadLibrary and GetProcAddress APIs.
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2009
    Posts
    1,355

    Re: we can add dll's by code?

    Quote Originally Posted by VictorN View Post
    What do you mean by "add dll's"?
    And in which platform?
    For example, (if what you meant was "execute some function from dll") in Windows you could use LoadLibrary and GetProcAddress APIs.
    what is mean is: the GCC compiler create exe's that are dependent of 2 DLL's(all exe's created with GCC). can i add these 2 DLL's to exe?´
    libgcc_s_sjlj-1.dll and libstdc++-6.dll
    (i know that because i have tested)
    Last edited by Cambalinho; August 27th, 2013 at 05:47 AM.

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: we can add dll's by code?

    Quote Originally Posted by Cambalinho View Post
    can i add these 2 DLL's to exe?´
    libgcc_s_sjlj-1.dll and libstdc++-6.dll
    Again: what do you meran by "add DLL's to exe"?
    Id your question about a redistribution of your application on other PCs? Or what else?
    Victor Nijegorodov

  5. #5
    Join Date
    Apr 2009
    Posts
    1,355

    Re: we can add dll's by code?

    Quote Originally Posted by VictorN View Post
    Again: what do you meran by "add DLL's to exe"?
    Id your question about a redistribution of your application on other PCs? Or what else?
    yes... for a redistribution of my application on other PCs. for don't be dependent from that 2 DLL's

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: we can add dll's by code?

    Then to make a static build.
    See also http://stackoverflow.com/questions/6...-dll-not-found
    Victor Nijegorodov

  7. #7
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: we can add dll's by code?

    a DLL is a Dynamic Link Library.

    so as the name implies, it does somewhat the same as a .lib (collection of object files) would do, but instead of linking it into the exe itself, they're provided side by side with the exe, and the exe loads the .dll from disk either when it starts or somewhere during it's runtime if and when it is needed.

    so no, you don't "link" a DLL into your exe, you provide the files alongside your exe.

    if you wanted to get a single .exe file then you shouldn't build DLL's, but make .lib's instead and link those into your exe.

  8. #8
    Join Date
    Apr 2009
    Posts
    1,355

    Re: we can add dll's by code?

    Quote Originally Posted by OReubens View Post
    a DLL is a Dynamic Link Library.

    so as the name implies, it does somewhat the same as a .lib (collection of object files) would do, but instead of linking it into the exe itself, they're provided side by side with the exe, and the exe loads the .dll from disk either when it starts or somewhere during it's runtime if and when it is needed.

    so no, you don't "link" a DLL into your exe, you provide the files alongside your exe.

    if you wanted to get a single .exe file then you shouldn't build DLL's, but make .lib's instead and link those into your exe.
    understand, but these DLL's are from GCC. so he tell me for use -static.

    i'm trying, but the compiler don't compile
    see these lines. they aren't C++(but VB), but you can understand:


    strCompilerName = App_Path & "\MinGW32\bin\g++.exe"
    strEXEFileName = """" & App_Path & "\test" & """"
    strCPPFonteName = """" & App_Path & "\test.cpp" & """"

    - the App_Path is the program folder.

    and heres how i use it:

    strCompilerName & " -o " & strEXEFileName & " " & strCPPFonteName & " -static"


    so what i'm doing wrong?

  9. #9
    Join Date
    Apr 2009
    Posts
    1,355

    Re: we can add dll's by code?

    YES!!!
    i found my error hehehehe
    i put, in that lines, the "& """"", but i didn't used in my code lol
    thanks for all

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