Pelles C forum

C language => Beginner questions => Topic started by: peter2005 on April 27, 2017, 09:49:40 PM

Title: exports
Post by: 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.

Code: [Select]
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.  :(
Title: Re: exports
Post by: frankie on April 28, 2017, 01:41:01 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?

Code: [Select]
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?

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.