Re: Converting .lib to .dll

Tech-Archive recommends: Speed Up your PC by fixing your registry



Following my earlier reply, I have made a start on what I think I need to
do. Please tell me if what I am doing is correct:
1) I have created a new VC++ 2005 project (Win32 Smart Device: Standard
SDK 500, dll, no ATL or MFC, Export Symbols). Called it Summit.
2) This creates a project containing cpp and h files. I have added the
sdc_sdk.h file to the project and the line #include<sdc_sdk.h> to the
Summit.cpp file
3) This allows me to use the definitions in the sdc_sdk.h file.
Following the example given in the created Summit.cpp file, I have gone
through each of the functions defined in the sdc_sdk.h file and added them
to the Summit.cpp file as follows:-
SUMMIT_API SDCERR GetCurrentConfig(DWORD *num, char *name)
{
//function definition should go here
}
I don't know how to write the function definition yet, so have added a
temporary line return SDCERR_SUCCESS;
4) I then added SUMMIT_API to the front of each function definition in
the sdc_sdk.h file (which is defined as __declspec(dllexport)). I assume
this declares the functions as visible externally.
To my great surprise, if I build this project, it actually compiles and
I end up with a DLL file! Now all I need to know is how to actually put the
code into my functions. I presume I need to add the supplied sdc_sdk.lib
file somewhere, but cannot see how to do it. I then need to call the
functions in the LIB file from my DLL functions. Any further help would be
greatly appreciated.

Andy Baker

"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message
news:OZSdndIlg-vXjMfVRVnyigA@xxxxxxxxxxxxxxxxx
Hi Paul

I have an application written in VB.NET / C# that uses the OpenNETCF
library for accessing network cards - setting SSID, connecting to devices,
getting status etc. I have been supplied with a new version of my device
and when I installed the application on it, I get an error message
wzcsapi.dll not found when trying to connect to a WLAN network -
presumably this is the windows zero config DLL that OpenNETCF requires to
work. For whatever reason, they cannot supply this file, but have instead
sent me a beta version of a new summit driver along with an SDK (LIB and
header file), the idea being that I write my code to control the device
using that rather than wzc. When I enquired about a .NET version, their
software people said they would write me a wrapper for it. However, they
said it would take 2 weeks and this was 3 weeks ago, and now they are
telling me that they have a large project that has taken priority. I don't
have a problem with that, after all they were (are) doing me a favour, but
it doesn't help, so I have been told to look into doing the job myself. I
understand the theory of what you are telling me to create my own native
DLL, unfortunately I am not a C programmer and don't have much of a clue
where to start with this. The questions that immediately come to mind are
do I use Visual C++ 2005 or Embedded C++ 4.0? What sort of project? Can I
get some example code to give me a starting point? Once I have the DLL, I
can to use P/Invoke to add it to my .NET application, I just need a kick
start. Do you have any suggestions? Thanks for your help.

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:eX78j0V0IHA.4424@xxxxxxxxxxxxxxxxxxxxxxx
Well, Summit is pretty well-known. Tell us first what you're trying to
do. We ship the driver for the Summit card with all of our devices and
I've never used any SDK, from native or managed code, with it. You're
trying to programmatically set the SSID and options or what?

If that's what you're trying to do, use the LIB file and declaration list
to create your own native DLL that exports some functions which you can
call from managed code (write your P/Invokes to match your own DLL's
exports). Presumably, the library actually implements the calls defined
in that header by making some calls to the driver directly, maybe via
DeviceIoControl() calls specific to the Summit card.

Paul T.

"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message
news:yvKdncOPH6Wct8TVnZ2dneKdnZydnZ2d@xxxxxxxxxxxxxxxxx
Thanks for that. I have done that, but unfortunately the functions
exported by that DLL are not the same as the ones in the SDK header
file, so I guess that means that it is not the correct DLL. I have
contacted our supplier to see if they can be of more help - if I get any
more information I will get back to you. Thanks again for your help.

Andy Baker

"Neil Cowburn" <neilc@[nospam]opennetcf.[nospam]com> wrote in message
news:2008061816143350073-neilc@xxxxxxxxxxxxxxxxxxxxxxxxxxx
On 2008-06-18 16:08:03 +0100, "Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx>
said:

is there a way of
seeing what functions are contained in the sdccf10g.dll file

Copy the DLL off the device onto your development PC. Open a Visual
Studio Command Prompt. Change the folder where you copied the DLL and
issue the following command:

dumpbin /exports sdccf10g.dll

This will list the functions exported by the DLL. Check that these are
the same as the functions listed in the header file. If so, then that's
the DLL you need to reference in your P/Invoke prototypes.

If you're *really* stuck, email me directly (remove the '[nospam]'
tokens from my alias) and we can help.

--
Neil Cowburn MVP
Principal Partner
OpenNETCF Consulting









.



Relevant Pages

  • Re: CByteBuffer implementation passed between modules
    ... If the RTL is dynamically linked, ... This forces the code to execute in the correct ... not in the context of the DLL. ... header file, but even if I did, it is legal and a valid way of coding. ...
    (microsoft.public.vc.mfc)
  • Re: CByteBuffer implementation passed between modules
    ... If the RTL is dynamically linked, ... By putting the code in the class definition, you force it to compile and ... not in the context of the DLL. ... header file, but even if I did, it is legal and a valid way of coding. ...
    (microsoft.public.vc.mfc)
  • Re: How to Move Two Dialogs at Once
    ... You would have to include the header file, because the resource.h for that DLL project has ... I hope we'd be able to fix this thing. ...
    (microsoft.public.vc.mfc)
  • Re: Converting .lib to .dll
    ... We ship the driver for the Summit card with all of our devices and I've ... create your own native DLL that exports some functions which you can call ... from managed code (write your P/Invokes to match your own DLL's exports). ... the same as the functions listed in the header file. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: import library not being created when dll is built
    ... > I used dumpbin to check the exports and you guessed right - it dosen't ... the projet does not come with a .def file. ... > This is a C++ DLL, ... That a look at the header file that defines the interface to the DLL (i.e., ...
    (microsoft.public.vc.language)