Calling .LIB from C# RRS feed

  • Question

  • I am working on an application due to lot of dll's to distribute to the users. I want to eliminate all DLL's and take .LIB files and embedd in exe file. Can someone give me a suggestion how to do that in C# windows mobile.

    DLLs coule be from C# libraries and C++ libraries
    Monday, May 18, 2009 12:46 AM


All replies

  • You can use "Reflection" to load assemblies at runtime to invoke and use.

    hope this helps.
    Prakash Subramani (MCAD)
    Monday, May 18, 2009 12:53 AM
  • What you probably want is something like ILMerge:

    Note that in C#, there is no such thing as LIB files. If you want to do static linking, then you should compile to netmodules and then link those into an exe; unfortunately, this isn't supported by VS, so you'd need to make your own build scripts.

    Programming blog: http://nitoprograms.blogspot.com/
    I will be in Chicago for the WPF training: http://blogs.msdn.com/jaimer/archive/2009/04/01/announcing-the-using-wpf-to-build-lob-applications-training-tour.aspx
    Monday, May 18, 2009 2:04 AM
  • Thank You for the quick replies.

    Yes. I want to do with static linking. Can somebody post the process to build the exe.

    I have .LIB files corresponding to the DLL's.

    The basic idea is I do not want to distribute DLL's to the end users. Can someone suggest best approach. 
    Monday, May 18, 2009 2:22 AM
  • Although the two other posts suggest you can you can't, there is no way to staticly link native code in a .lib file to a manged application, the best you can do is supply the dll's with your application and use dllimport to import the functions. I know you dont want to distribute the dll's but you have no other choice unless you are able to compile whatever code is in the .lib file to managed code then you could use the netmodules mentioned earlier but with native x86 code you are out of luck.
    • Proposed as answer by Mattias Sjögren Monday, May 18, 2009 12:07 PM
    • Marked as answer by Harry Zhu Monday, May 25, 2009 1:50 AM
    Monday, May 18, 2009 3:38 AM