Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8224737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:10:25+00:00 2026-06-07T15:10:25+00:00

I have application for Windows Mobile 6. To build it I use cegcc (arm-mingw32ce).

  • 0

I have application for Windows Mobile 6. To build it I use cegcc (arm-mingw32ce).
Now I have new device with new SDK and some functions from this SDK must be added to this application.
Here comes SDK.

header.h

#ifndef _HEADER_H_
#define _HEADER_H_

#include <windows.h>

#ifndef _SOME_FLAG_
extern "C"
{
#endif

BOOL foo(DWORD *lpdwParam1, DWORD *lpdwParam2);

#ifndef _SOME_FLAG_
}
#endif

#endif  

library.lib (this is probably import library compiled with VC++, there is library.dll on device)

Some output from “dumpbin /all library.lib”

2DA0 ?foo@@YAHPAK0@Z
2DA0 __imp_?foo@@YAHPAK0@Z

Archive member name at 2DA0: library.dll/
correct header end
Version      : 0
Machine      : 1C2 (Thumb)
SizeOfData   : 0000002B
DLL name     : library.dll
Symbol name  : ?foo@@YAHPAK0@Z (int __cdecl foo(unsigned long *,unsigned long *))
Type         : code
Name type    : undecorate
Hint         : 14
Name         : foo

I’m able to use this SDK in VS2k5 (installation of Windows Mobile SDK was needed…) but compiling with cegcc fail.

I was trying to compile and link it as C and Cpp. With and without _SOME_FLAG_ defined (C compilation with this flag set fail on extern “C” of course).

The results are:

undefined reference to `foo'

when C compiled or Cpp compiled with extern “C” and

undefined reference to `foo(unsigned long*, unsigned long*)'

when Cpp compiled without extern “C”.

Compile:

gcc -O2 -Wall -Wextra -pedantic -Wno-long-long -g -c -DUNICODE -D_UNICODE -Ic:\inc sample.c

Linking:

gcc -static -mconsole -o sample obj\sample.o -lc:\lib\library.lib -laygshell

When I Cpp compile I’m only changing sample.c to sample.cpp (there is only main with simple foo call).

It look like there is a mangling problem (vc++ vs gcc). I’ve tried to add __attribute__((dllimport)) and __attribute__((cdecl))

How can I solve this problem? Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:10:26+00:00Added an answer on June 7, 2026 at 3:10 pm

    Problem solved. I’ve forget about possibility of run-time dynamic linking

    #include <windows.h>
    #include <winbase.h>
    #include <header.h>
    
    HINSTANCE dllinst = NULL;
    typedef BOOL (CALLBACK LP_FOO)(DWORD *lpdwParam1, DWORD *lpdwParam2);
    static LP_FOO Foo;
    
    dllinst = LoadLibrary("library.dll");
    Foo = (LP_FOO) GetProcAddress((HMODULE) dllinst, "foo");
    

    Now I can use Foo same as foo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to build a GUI application on Windows Mobile, and would like it
I have a Windows Mobile Desktop Application that have some text fields which will
I have a Windows Mobile application in which I want to check the device
Hello frnds I have windows mobile application, that retrieves location info. Now i want
I have written a basic Application for windows mobile 5. It is using visual
We have a business application written for Windows mobile. It has people doing inventories.
I have a WTL 8.0 SDI application for Windows Mobile 5. In this contrived
I have the following problem: I implemented a managed mobile application for Windows Mobile
I have a windows mobile 5.0 application (smartphone) that contains a flat data file
I have a Windows Mobile 6.0 application with SQL Server CE 3.5 on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.