NO

Author Topic: cdecl or stdcall  (Read 10709 times)

zenonpro

  • Guest
cdecl or stdcall
« on: March 21, 2007, 01:14:50 PM »
Hi folks,
I currently have a project with an application, two DLL's and the sqlite dll (compiled with the project file found on this site).  When I run the app, I get a runtime error the moment I use the sqlite library.  I found out that it all comes down to the following: my dll's and app has been compiled with the WINAPI = stdcall but the sqlite dll has been compiled with the cdecl setting.  Trying to compile the sqlite with stdcall setting resulted in numerous errors.  Is there a way to prevent from runtime errors by changing my calls to the functions of the sqlite dll, or is there no way besides compiling everything in the same setting.  cdecl or stdcall ???

Thanks,
Pascal

JohnF

  • Guest
cdecl or stdcall
« Reply #1 on: March 21, 2007, 02:16:23 PM »
I would imagine that specifying individual functions with either __cdecl or __stdcall as you require will solve your problem.

Btw, __cdecl is the standard C calling convention and __stdcall is the standard calling convention for Windows.

Example proto
int __cdecl FormatC(String * this, char * format, ... );

Example func
int __cdecl FormatC(String * this, char * format, ... )
{
  code
}

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
cdecl or stdcall
« Reply #2 on: March 21, 2007, 06:53:25 PM »
SQLite *must* be compiled with the _cdecl calling convention. I ended up tweaking the sqlite3.h file myself (see attachment). Since they release new 3.x versions all the time, this quickly becomes *very* annoying...

A very good addition to the sqlite package would be to change the prototypes to something similar to the ZLIB package, like ZEXTERN int ZEXPORT somefunction(...), where ZEXTERN and ZEXPORT can be defined as nothing, or something more useful for the Windows environment.
/Pelle

niesen

  • Guest
Re: cdecl or stdcall
« Reply #3 on: March 29, 2007, 10:01:08 PM »
SQLite *must* be compiled with the _cdecl calling convention. I ended up tweaking the sqlite3.h file myself (see attachment). Since they release new 3.x versions all the time, this quickly becomes *very* annoying...

A very good addition to the sqlite package would be to change the prototypes to something similar to the ZLIB package, like ZEXTERN int ZEXPORT somefunction(...), where ZEXTERN and ZEXPORT can be defined as nothing, or something more useful for the Windows environment.

Can I  have the change headers to, because we use sqlite to.


Offline Robert

  • Member
  • *
  • Posts: 247
Re: cdecl or stdcall
« Reply #4 on: March 30, 2007, 05:51:00 AM »

Can I  have the change headers to, because we use sqlite to.


Login to the forum and you will see, attached to Pelle's post, the attachment with the sqlite.h. If you are not logged in, you can not see the attachments.

Robert Wishlaw

tbneff

  • Guest
Re: cdecl or stdcall
« Reply #5 on: September 09, 2008, 01:41:05 AM »
I am trying to compile sqlite for the pocket pc. I downloaded the source for sqlite for win_ce (latest version 3.3.5). I am trying to create a static .lib, but in the project options it will not allow me to define _cdecl for the ARM processor. When I switch to the X86 processor, it will give me the option of _cdecl. But as soon as I switch to ARM processor, the option is greyed out to _stdcall.

I tried clicking on the attachment for the sqlite3.h file that Pelle tweaked, but it gave me the error 'Attachment not found'.

I would love to find out how to get this compiled properly, because my app is not working in the Mobile Emulator.

Thanks,
tbneff

cick

  • Guest
Re: cdecl or stdcall
« Reply #6 on: September 13, 2008, 12:01:11 AM »
Hello Pelle,
can you upload the file sqlite3.h again ?
I can't  compile sqlite 3.3.5 for WINCE.
Christian wrote:

Hello @ all,
due to a configuration error, the attachments and avatars hasn't been saved correctly.
So please, if you miss a attachment or avatar (especially if the upload date is later than the change to this location), upload the file once again.
I hope that the most attachments are back.


Thanks
cick