News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

exports

Started by peter2005, April 27, 2017, 09:49:40 PM

Previous topic - Next topic

peter2005

Hi, I want to create lib/dll with exports from already existing c code, so I placed this dll snippet into the code and both functions plusI and plusF are exported fine.


BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:  break;
        case DLL_THREAD_ATTACH:   break;
        case DLL_THREAD_DETACH:   break;
        case DLL_PROCESS_DETACH:  break;
    }
    return TRUE;
}

__declspec(dllexport) int  __cdecl plusI(int a, int b) {  return a + b;  }

__declspec(dllexport) double  __cdecl plusF(double a, double b) {  return a + b;  }


However when I add __declspec(dllexport) int  ... to any other function from the original code  there is no error but the export in created dll does not exist.  :(

frankie

#1
Quote from: peter2005 on April 27, 2017, 09:49:40 PM
Hi, I want to create lib/dll with exports from already existing c code, so I placed this dll snippet into the code and both functions plusI and plusF are exported fine.
In which code? In the library? or this is a new sample library?

Quote from: peter2005 on April 27, 2017, 09:49:40 PM

BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:  break;
        case DLL_THREAD_ATTACH:   break;
        case DLL_THREAD_DETACH:   break;
        case DLL_PROCESS_DETACH:  break;
    }
    return TRUE;
}
__declspec(dllexport) int  __cdecl plusI(int a, int b) {  return a + b;  }

__declspec(dllexport) double  __cdecl plusF(double a, double b) {  return a + b;  }

This is your library?

Quote from: peter2005 on April 27, 2017, 09:49:40 PM
However when I add __declspec(dllexport) int  ... to any other function from the original code  there is no error but the export in created dll does not exist.  :(
Which original code?
Do you mean that your sample library works and some other code not?

Sorry, but is not clear at all.
Post a sample minimal project that shows the problem.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide