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 7490049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:30:25+00:00 2026-05-29T15:30:25+00:00

I am using a macro to do simple logging on different platforms. Here’s some

  • 0

I am using a macro to do simple logging on different platforms. Here’s some of what I use on android:

#include <android/log.h>
#define __ENGINE_LOG_INFO(msg, argptr) __android_log_vprint(ANDROID_LOG_INFO, __ENGINE_LOG_TAG, msg, argptr);

And here’s the corresonding I’ve tried on windows:

#elif defined _WIN32 || _WIN64
#include <stdarg.h>
#include <stdio.h>
#define __ENGINE_LOG_INFO(msg, argptr)  printf ("%s:%s",__ENGINE_LOG_TAG,"DEBUG:"); printf(msg, argptr); printf("\n");

The macro is invoked in this function:

void LogManagerImpl::LogInfo(const char* msg, ...)
{
    va_list argptr;
    va_start(argptr, msg);
    __ENGINE_LOG_INFO(msg, argptr);
    va_end(argptr);
}

For example, I use it like this:

engine->GetLogger()->LogInfo("TEST: MemoryManagerTest:AllocateWithMemPool: Loop time: %d msec", timeStop - timeStart);

This works fine on Android, but for some reason it seems to print bogus values in Windows (it is the exact same value everytime – a very big value). I am starting to think it looks like an address, but I’m not sure why its not working. 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-05-29T15:30:31+00:00Added an answer on May 29, 2026 at 3:30 pm

    You want to use vprintf(msg, argptr); rather than printf(msg, argptr); in your windows version. The vprintf() function was designed to work with a va_list type as the container for the actual argument values that will be matched against the values indicated in the input character string, where-as printf() was not.

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

Sidebar

Related Questions

I have a case where I'm using a macro to generate simple subclasses. I've
I'm trying to create a fairly simple macro in Word 2010 using Visual Basic.
My problem is quite simple. I want the following macro #define PROXYPASS(name, param) \
I have a simple class library that I use in Excel. Here is a
I've been trying to use the system call ptrace (using the PTRACE_SINGLESTEP macro) to
When using C preprocessor one can stringify macro argument like this: #define TO_STRING(x) a
I'm using the macro defined here , on Windows 7, however it always returns
I am using Leonid's macro method ( see here ) to help me manage
Here's a simple example: #include <stdlib.h> int main(void) { _set_error_mode(_OUT_TO_STDERR); return EXIT_SUCCESS; } When
I got a macro I am using for debugging/logging, simply: MY_DEBUG_INFO(msg...) this works fine

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.