libxml2 use for ipad - iphone

When I use libxml2 in my ipad project (i use the dylib and add the header flags correctly) it doesn't build and gives the error:
/Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/libxml2/libxml/xmlversion.h:24
Expected '=','','.','asm' or 'atrribute' before 'void'.
line 23-25 of xmlversion.h is
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
What am i doing wrong ?
Thanks in advance!
Kristof

I dug up an older project that compiles directly against libxml2.
Do you have "/usr/include/libxml2" in your Header Search Paths project build setting?

Related

#include of a system header from a modularized project header file gives "Include of non-modular header inside framework module..." error

I am trying to embed libarchive in a Swift-based framework I am building.
I created a module map to privately include archive.h (inside module libarchive near the end)
framework module X
{
requires objc, blocks, objc_arc
umbrella header "X.h"
private header "XPrivate.h"
private header "x.h"
use Darwin.C
module libarchive
{
private header "archive.h"
export *
}
}
Inside archive.h, the following line is causing the error:
#include <inttypes.h>
I don't understand why this include isn't being mapped to the correct inttypes module in my SDK.
There is a module Darwin.C.inttypes is defined inside my SDK, here:
/Applications/Xcode.app/.../MacOSX10.12.sdk/usr/include/module.modulemap
Can someone tell me how to get the #include in archive.h to map to the declared module?
Pretend to be a system framework by changing to framework module X [system].
Not the correct solution but it seems to work.

Swift #import of module '<module name>' in implementation of <Project name>; use #import

I'm trying to create a mixed ObjC-Swift framework. But I'm losing a lot of hairs trying to make a private module for my Swift files.
I followed some steps in iOS mixed dynamic framework - bridge objc headers with private module combined with some steps in https://stackoverflow.com/a/36878037/749438
Basically I have a module.modulemap now which has the following content:
module MyCore { //Adding 'framework' before module is giving me an "Umbrella not found"-error :/
umbrella header "MyCore.h"
export *
module * { export * }
explicit module MyCorePrivate {
header "MyCore_PrivateUmbrella.h"
export *
}
}
The MyCore_PrivateUmbrella.h imports all headers I want to privately expose to my Swift code. The reason behind it is just that it's easier to include 1 header in the module then all the to-be-exposed headers (since you need to include the specific paths to the headers...).
My build settings look like:
DEFINES_MODULE: YES
PRODUCT_MODULE_NAME: MyCore
CLANG_ENABLE_MODULES: YES
SWIFT_OBJC_INTERFACE_HEADER_NAME: MyCore-Swift.h
SWIFT_INCLUDE_PATHS: path to the directory of the module.modulemap
and last but not least; ALWAYS_SEARCH_USER_PATHS is set to NO
In my Swift files I import the module using import MyCore.MyCorePrivate. This works as expected and I can use my code from Objective-C.
Building the project gives me an error like this (the black bars only hide the project name and path to the file):
Now clicking the error brings me to the generated MyCore-Swift.h where the #import MyCore.MyCorePrivate is seemingly wrong.
I've got no idea as of why it's wrong, neither do I know how to fix this. Especially since it's a file generated by XCode.
Does anyone knows what's going down here?
You will need to modify the resulting framework after building it:
1) Don't create any private modules. Revert back to default settings.
2) Any code you want to expose to swift add to your framework header and make sure the headers are set as public in the build section or else swift code wont have access. (Use the <> syntax)
3) Any code from swift to objc make public.
4) Compile you project
5) go to your framework build directory (i.e MyFramework.framework)
6) open the framework header file in the headers directory of the framework (Myframework.h file)
7) Delete all the import statements that should have been private from the framework header
8) Delete all the .h files for the headers that should have been private from the headers directory ( you removed the import statements from the main framework header)
9) go to the .module file and remove the swift modules section
The module file should be very bare bones:
framework module MyFramework {
umbrella header "MyFramework.h" export * module * {export *}}

Npapi Plugin not detected in demobrowser of QtWebkit

I am a newbie to StackOverflow and QtWebkit as well.
I have written a very basic Npapi plugin which has functions like NP_GetMimeTypeDescription and Np_Initialise etc for Mimetype application/basic-plugin and Mimetype description application/basic-plugin:bsc:Plug-ins SDK sample.
But I am facing a problem while loading it on the demobrowser of QtWebKit and also on Mozilla Firefox. I have placed the generated .so file in the paths where ever browser finds plugins like /usr/lib/mozilla/plugins/ and Qt Lib path.
I have a test.html file which contains the Mimetype application/basic-plugin. I am trying to launch this plugin in both the Mozilla browser and QtWebKit Demo Browser But in both the cases its not launching the plugin.
I am not able to find out why.
Any suggestions are Welcome...
Thanks for help and suggestions.
I was able to find out the problem why my plugin was not getting invoked,
even if I placed the .so file in the correct folders
/usr/lib/mozilla/plugins/ and Qt Lib path.
There were 2 reasons...
Had to enable the Define XP_UNIX (-DXP_UNIX) during compilation as a compiler directive.
This will consider different prototypes of the functions and also implementation
extern "C"
NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs
#ifdef XP_UNIX
, NPPluginFuncs *pluginFuncs
#endif
)
{
// keep a pointer to the browser functions
g_browser = browserFuncs;
// any memory that is to be shared by all instances of
the browser plugin should be initialized here.
;
#ifdef XP_UNIX
// under Linux, as the browser won't call NP_GetEntryPoints()
explicitly, do it now to fill in <pluginFuncs>
return NP_GetEntryPoints(pluginFuncs);
#else
return NPERR_NO_ERROR;
#endif
}
and
extern "C"
#ifdef XP_UNIX
NPError NP_GetValue(void* instance, NPPVariable variable, void *value)
#else
NPError NP_GetValue(NPP instance, NPPVariable variable, void *value)
#endif
2.. There were 2 functions NP_GetValue and NPP_GetValue.
extern "C"
NPError NP_GetValue(void* instance, NPPVariable variable, void *value);
and
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *ret_value);
NPP_GetValue is a plugin function whose registration should be made in
NP_GetEntryPoints
extern "C"
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* NPPluginFuncsptr)
{
......
NPPluginFuncsptr->newp = NPP_New;
NPPluginFuncsptr->getvalue = NPP_GetValue;
NPPluginFuncsptr->setvalue = NPP_SetValue;
return NPERR_NO_ERROR;
}
In my code only NP_GetValue was implemented and NPP_GetValue was not implemented.
So NPP_GetValue was undefined in .so and due to it the .so was not loading.
On implementing the function NPP_GetValue this function was defined and exported in the .so file and was able to load it successfully.
The sequence of calling of the functions from the browser to plugin is as follows...
NP_Initialize - > Browser calls the initialization function first.
(In case of Linux the set of plugin function should be exported by calling
NP_GetEntryPoints explicity As browser will not call GetEntryPoints)
NP_GetEntryPoints -> Called explicitly from NP_Initialize for Linux to
expose/export plugin functions.
NP_GetValue variable : 1 -> Called from Browser to get the Plugin Name
(NPPVpluginNameString)
NP_GetValue variable : 2 -> Called from Browser to get the
Plugin Description (NPPVpluginDescriptionString)
NP_GetMimeDescription -> Called from browser to get MimeType Description
(This function should return Mime Type description
e.g. :
return("application/basic-plugin:bsc:Plug-ins SDK sample");)
NPP_New -> Called from browser to create plugin instance.
NPP_GetValue PLUGIN:main.cpp,NPP_GetValue,446ENTRY - > Called from browser to get plugin specific data...
......
Please note that the next function in the above sequence will be called
IF and ONLY IF the previous function call returns a success.:-)

Compile Failing for iOS 4 with Sqlite

I wrote an iPhone app against SDK 2.2, I have updated my XCode and SDK so now I only have SDK 4.2 and I want to update my app to run with that.
The problem is I can't even get it to compile!
I get the following error:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/sqlite3.h:5772: error: expected '=', ',', ';', 'asm' or 'attribute' before 'int'
The line in question is:
SQLITE_API int sqlite3_rtree_geometry_callback(
sqlite3 *db,
const char *zGeom,
int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes),
void *pContext
);
I have tried relinking the newer sqlite frameworks, both libsqlite3.dylib and libsqlite3.dylib, but both still cause this error.
If I comment out my import statement (#import "sqlite3.h"), it compiles just fine. (Although it crashes when I run it, obviously.)
I've used the same way Sqlite.h use to import this library:
#import <sqlite3.h>
and it solved the issue.
I ended up creating a new project, and importing all the files from the original, and then linking the sqlite framework. After that it compiled just fine.
I managed to make it work after replacing #import "sqlite3.h" by #import "/usr/include/sqlite3.h"

three20 p31 syntax error with UIAccessibilityTraits

i downlaoded three20 p31. when i tried to build i got errors in following places
- (UIAccessibilityTraits) accessibilityTraits {
return [super accessibilityTraits] | UIAccessibilityTraitStaticText;
}
the same function is used in 3 classes. TTbutton.m,TTLabel.m,TTstyledTestlabel.m
. i simply commented all funnctions containing UIAccessibilityTraits.Then my syantax errors got removed. i found out that in my UIkit framework there is no UIAccessibility.h file. is it my sdk problem ? Why UIAccessibility not included in my UIkit ?
What version of the iPhone SDK do you use and what version do you compile for? The accessibility traits were added in 3.0.